From ae4ee34ad42abb97d658c1ac26117d0ffe364f9a Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 6 Apr 2013 15:49:55 +1100 Subject: [PATCH] Small timeouts on select() instead of instant timeout increase reliability of socket reads and writes. --- util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util.c b/util.c index 5665f809..5497e7a8 100644 --- a/util.c +++ b/util.c @@ -912,7 +912,7 @@ static bool __stratum_send(struct pool *pool, char *s, ssize_t len) len++; while (len > 0 ) { - struct timeval timeout = {0, 0}; + struct timeval timeout = {1, 0}; ssize_t sent; fd_set wd; @@ -966,7 +966,7 @@ static bool socket_full(struct pool *pool, bool wait) if (wait) timeout.tv_sec = 60; else - timeout.tv_sec = 0; + timeout.tv_sec = 1; if (select(sock + 1, &rd, NULL, NULL, &timeout) > 0) return true; return false;