From 1932659baa0a0ea458e152a5bbdd827b463b05a5 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 8 Sep 2015 12:14:43 +1000 Subject: [PATCH] Send a reconnect message on failure to passthrough send, assuming a connection has failed. --- src/generator.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/generator.c b/src/generator.c index 576c8709..760f11e0 100644 --- a/src/generator.c +++ b/src/generator.c @@ -1419,7 +1419,7 @@ static void *passthrough_recv(void *arg) return NULL; } -static void passthrough_send(ckpool_t __maybe_unused *ckp, pass_msg_t *pm) +static void passthrough_send(ckpool_t *ckp, pass_msg_t *pm) { int len, sent; @@ -1427,8 +1427,9 @@ static void passthrough_send(ckpool_t __maybe_unused *ckp, pass_msg_t *pm) len = strlen(pm->msg); sent = write_socket(pm->cs->fd, pm->msg, len); if (sent != len) { - /* FIXME: Do something about this? */ - LOGWARNING("Failed to passthrough %d bytes of message %s", len, pm->msg); + LOGWARNING("Failed to passthrough %d bytes of message %s, attempting reconnect", + len, pm->msg); + send_proc(ckp->generator, "reconnect"); } free(pm->msg); free(pm);