Browse Source

Cope with read_socket_line timeouts properly in generator

master
Con Kolivas 9 years ago
parent
commit
88e78a02da
  1. 8
      src/generator.c

8
src/generator.c

@ -1261,9 +1261,9 @@ static void *proxy_recv(void *arg)
while (42) { while (42) {
notify_instance_t *ni, *tmp; notify_instance_t *ni, *tmp;
share_msg_t *share, *tmpshare; share_msg_t *share, *tmpshare;
int retries = 0, ret;
float timeout; float timeout;
time_t now; time_t now;
int ret;
now = time(NULL); 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 /* If we don't get an update within 10 minutes the upstream pool
* has likely stopped responding. */ * has likely stopped responding. */
timeout = 600;
do { do {
timeout = 10;
if (cs->fd == -1) { if (cs->fd == -1) {
ret = -1; ret = -1;
break; break;
} }
ret = read_socket_line(cs, &timeout); ret = read_socket_line(cs, &timeout);
} while (ret == 0 && ++retries < 120); } while (ret == 0 && timeout > 0);
if (ret < 1) { if (ret < 1) {
/* Send ourselves a reconnect message */ /* Send ourselves a reconnect message */
@ -1403,7 +1403,7 @@ static void *passthrough_recv(void *arg)
do { do {
ret = read_socket_line(cs, &timeout); ret = read_socket_line(cs, &timeout);
} while (ret == 0); } while (ret == 0 && timeout > 0);
if (ret < 1) { if (ret < 1) {
/* Send ourselves a reconnect message */ /* Send ourselves a reconnect message */

Loading…
Cancel
Save