Browse Source

Hold semaphore till we've sent the buffer

master
Con Kolivas 9 years ago
parent
commit
daa3fde1ab
  1. 6
      src/generator.c

6
src/generator.c

@ -2014,20 +2014,20 @@ static void *passthrough_recv(void *arg)
/* Make sure we receive a line within 90 seconds */ /* Make sure we receive a line within 90 seconds */
cksem_wait(&cs->sem); cksem_wait(&cs->sem);
ret = read_socket_line(cs, &timeout); ret = read_socket_line(cs, &timeout);
cksem_post(&cs->sem);
if (ret < 1) { if (ret < 1) {
reconnect_generator(ckp);
LOGWARNING("Proxy %d:%s failed to read_socket_line in passthrough_recv, attempting reconnect", LOGWARNING("Proxy %d:%s failed to read_socket_line in passthrough_recv, attempting reconnect",
proxi->id, proxi->url); proxi->id, proxi->url);
alive = proxi->alive = false; alive = proxi->alive = false;
Close(cs->fd); Close(cs->fd);
reconnect_generator(ckp);
cksem_post(&cs->sem);
continue; continue;
} }
/* Simply forward the message on, as is, to the connector to /* Simply forward the message on, as is, to the connector to
* process. Possibly parse parameters sent by upstream pool * process. Possibly parse parameters sent by upstream pool
* here */ * here */
send_proc(ckp->connector, cs->buf); send_proc(ckp->connector, cs->buf);
cksem_post(&cs->sem);
} }
return NULL; return NULL;
} }

Loading…
Cancel
Save