From a6778ed6bf02bc95d5da124b671880e5a1fd5df3 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Fri, 1 Oct 2004 20:20:41 +0000 Subject: Send NOOPs to the server during slow connections to prevent timeouts. Bug #134 --- common/spio.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'common/spio.c') 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); -- cgit v1.2.3