summaryrefslogtreecommitdiff
path: root/common/spio.c
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2004-10-01 20:20:41 +0000
committerStef Walter <stef@memberwebs.com>2004-10-01 20:20:41 +0000
commit854196b9645097bac7dc806d1a3a08c1ef379a3b (patch)
tree8e311f4ce59b9a15b7e93db1f08c3a05484eb11c /common/spio.c
parent2a32d4becef9c2614be1ef574ba28d50ad8ec3f9 (diff)
Send NOOPs to the server during slow connections to prevent timeouts. Bug #134
Diffstat (limited to 'common/spio.c')
-rw-r--r--common/spio.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/common/spio.c b/common/spio.c
index 67d32b1..4075e9a 100644
--- a/common/spio.c
+++ b/common/spio.c
@@ -245,6 +245,9 @@ unsigned int spio_select(spctx_t* ctx, ...)
if(i > (sizeof(int) * 8) - 2)
break;
+ /* We have data on the descriptor, which is an action */
+ io->last_action = time(NULL);
+
/* Check if the buffer has something in it */
if(FD_ISSET(io->fd, &mask))
ret |= (1 << i);
@@ -363,6 +366,9 @@ int read_raw(spctx_t* ctx, spio_t* io, int opts)
return count;
}
+ /* Read data which is a descriptor action */
+ io->last_action = time(NULL);
+
/* Check for a new line */
p = (char*)memchr(at, '\n', x);
if(p != NULL)
@@ -489,6 +495,8 @@ int spio_write_data_raw(spctx_t* ctx, spio_t* io, unsigned char* buf, int len)
if(io->fd == -1)
return 0;
+ io->last_action = time(NULL);
+
while(len > 0)
{
r = write(io->fd, buf, len);
@@ -556,6 +564,8 @@ void spio_read_junk(spctx_t* ctx, spio_t* io)
if(l <= 0)
break;
+ io->last_action = time(NULL);
+
buf[l] = 0;
t = trim_start(buf);