Browse Source

Close socket reliably in generator

master
Con Kolivas 10 years ago
parent
commit
8dd1754426
  1. 4
      src/generator.c

4
src/generator.c

@ -1946,6 +1946,7 @@ static int proxy_loop(proc_instance_t *pi)
setup_proxies(ckp, gdata); setup_proxies(ckp, gdata);
reconnect: reconnect:
Close(sockd);
/* This does not necessarily mean we reconnect, but a change has /* This does not necessarily mean we reconnect, but a change has
* occurred and we need to reexamine the proxies. */ * occurred and we need to reexamine the proxies. */
cproxy = wait_best_proxy(ckp, gdata); cproxy = wait_best_proxy(ckp, gdata);
@ -1963,6 +1964,7 @@ reconnect:
} }
} }
retry: retry:
Close(sockd);
do { do {
selret = wait_read_select(us->sockd, 5); selret = wait_read_select(us->sockd, 5);
if (!selret && !ping_main(ckp)) { if (!selret && !ping_main(ckp)) {
@ -1990,7 +1992,6 @@ retry:
buf = recv_unix_msg(sockd); buf = recv_unix_msg(sockd);
if (!buf) { if (!buf) {
LOGWARNING("Failed to get message in proxy_loop"); LOGWARNING("Failed to get message in proxy_loop");
Close(sockd);
goto retry; goto retry;
} }
LOGDEBUG("Proxy received request: %s", buf); LOGDEBUG("Proxy received request: %s", buf);
@ -2022,7 +2023,6 @@ retry:
else else
submit_share(gdata, val); submit_share(gdata, val);
} }
Close(sockd);
goto retry; goto retry;
out: out:
Close(sockd); Close(sockd);

Loading…
Cancel
Save