From 88e78a02da9d261e297903904daff77b2045db86 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 21 Sep 2015 16:22:09 +1000 Subject: [PATCH] Cope with read_socket_line timeouts properly in generator --- src/generator.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/generator.c b/src/generator.c index 0336d257..c8fec756 100644 --- a/src/generator.c +++ b/src/generator.c @@ -1261,9 +1261,9 @@ static void *proxy_recv(void *arg) while (42) { notify_instance_t *ni, *tmp; share_msg_t *share, *tmpshare; - int retries = 0, ret; float timeout; time_t now; + int ret; now = time(NULL); @@ -1290,14 +1290,14 @@ static void *proxy_recv(void *arg) /* If we don't get an update within 10 minutes the upstream pool * has likely stopped responding. */ + timeout = 600; do { - timeout = 10; if (cs->fd == -1) { ret = -1; break; } ret = read_socket_line(cs, &timeout); - } while (ret == 0 && ++retries < 120); + } while (ret == 0 && timeout > 0); if (ret < 1) { /* Send ourselves a reconnect message */ @@ -1403,7 +1403,7 @@ static void *passthrough_recv(void *arg) do { ret = read_socket_line(cs, &timeout); - } while (ret == 0); + } while (ret == 0 && timeout > 0); if (ret < 1) { /* Send ourselves a reconnect message */