Browse Source

Close the passthrough socket if it's not already on a failed write in passthrough_send

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

8
src/generator.c

@ -1717,14 +1717,16 @@ static void *proxy_send(void *arg)
static void passthrough_send(ckpool_t *ckp, pass_msg_t *pm)
{
connsock_t *cs = pm->cs;
int len, sent;
LOGDEBUG("Sending upstream json msg: %s", pm->msg);
len = strlen(pm->msg);
sent = write_socket(pm->cs->fd, pm->msg, len);
if (sent != len) {
sent = write_socket(cs->fd, pm->msg, len);
if (unlikely(sent != len)) {
LOGWARNING("Failed to passthrough %d bytes of message %s, attempting reconnect",
len, pm->msg);
Close(cs->fd);
reconnect_generator(ckp);
}
free(pm->msg);
@ -1912,8 +1914,6 @@ static void *passthrough_recv(void *arg)
}
sleep(5);
}
if (!alive)
reconnect_generator(ckp);
/* Make sure we receive a line within 90 seconds */
ret = read_socket_line(cs, &timeout);

Loading…
Cancel
Save