diff options
author | Stef Walter <stef@memberwebs.com> | 2004-09-23 16:32:08 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2004-09-23 16:32:08 +0000 |
commit | 58e0f4b3ee454a6ca561e007901df978ee636a4d (patch) | |
tree | 99aa3a5351e93fb7129174f05ddc15d7ace3fcd3 | |
parent | 19ad64d05534d1013c67382723c7df83a5e609c3 (diff) |
Fix problems with select zeroing out timeouts.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | common/spio.c | 7 |
2 files changed, 8 insertions, 2 deletions
@@ -1,3 +1,6 @@ +0.9.1 + - Fixed problems with the select zeroing out timeouts. + 0.9 - Don't quit when too many threads created - Restructured smtp passthru system so it can be used by other apps diff --git a/common/spio.c b/common/spio.c index 91e2da0..67d32b1 100644 --- a/common/spio.c +++ b/common/spio.c @@ -169,6 +169,7 @@ unsigned int spio_select(spctx_t* ctx, ...) int have = 0; int i = 0; va_list ap; + struct timeval timeout; ASSERT(ctx); FD_ZERO(&mask); @@ -207,9 +208,11 @@ unsigned int spio_select(spctx_t* ctx, ...) for(;;) { + /* Select can modify the timeout argument so we copy */ + memcpy(&timeout, &(g_state.timeout), sizeof(timeout)); + /* Otherwise wait on more data */ - switch(select(FD_SETSIZE, &mask, NULL, NULL, - (struct timeval*)&(g_state.timeout))) + switch(select(FD_SETSIZE, &mask, NULL, NULL, &timeout)) { case 0: sp_messagex(ctx, LOG_ERR, "network operation timed out"); |