From 8dd1754426901ebb62c1275b7179929260c40676 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 20 Feb 2015 17:56:03 +1100 Subject: [PATCH] Close socket reliably in generator --- src/generator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/generator.c b/src/generator.c index c0abfb42..b2b5539d 100644 --- a/src/generator.c +++ b/src/generator.c @@ -1946,6 +1946,7 @@ static int proxy_loop(proc_instance_t *pi) setup_proxies(ckp, gdata); reconnect: + Close(sockd); /* This does not necessarily mean we reconnect, but a change has * occurred and we need to reexamine the proxies. */ cproxy = wait_best_proxy(ckp, gdata); @@ -1963,6 +1964,7 @@ reconnect: } } retry: + Close(sockd); do { selret = wait_read_select(us->sockd, 5); if (!selret && !ping_main(ckp)) { @@ -1990,7 +1992,6 @@ retry: buf = recv_unix_msg(sockd); if (!buf) { LOGWARNING("Failed to get message in proxy_loop"); - Close(sockd); goto retry; } LOGDEBUG("Proxy received request: %s", buf); @@ -2022,7 +2023,6 @@ retry: else submit_share(gdata, val); } - Close(sockd); goto retry; out: Close(sockd);