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
commita6778ed6bf02bc95d5da124b671880e5a1fd5df3 (patch)
tree07e2cdc0bf30683821b6274670cfcae6674a7bad /common/spio.c
parent8f37ccc8081a8a8b53b27069ebc7c518ec6e0632 (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);