From 61300493e79a206d82d4633e0e69cfca69675153 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Wed, 19 Nov 2014 21:29:18 +1100 Subject: [PATCH] Empty buffers of servers and proxy when killing them --- src/ckpool.h | 1 + src/generator.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/ckpool.h b/src/ckpool.h index d246e97f..6c7743a2 100644 --- a/src/ckpool.h +++ b/src/ckpool.h @@ -188,6 +188,7 @@ bool ckmsgq_empty(ckmsgq_t *ckmsgq); ckpool_t *global_ckp; bool ping_main(ckpool_t *ckp); +void empty_buffer(connsock_t *cs); int read_socket_line(connsock_t *cs, int timeout); bool _send_proc(proc_instance_t *pi, const char *msg, const char *file, const char *func, const int line); #define send_proc(pi, msg) _send_proc(pi, msg, __FILE__, __func__, __LINE__) diff --git a/src/generator.c b/src/generator.c index f9791257..0fd73d55 100644 --- a/src/generator.c +++ b/src/generator.c @@ -225,6 +225,7 @@ static void kill_server(server_instance_t *si) LOGNOTICE("Killing server"); cs = &si->cs; Close(cs->fd); + empty_buffer(cs); dealloc(cs->url); dealloc(cs->port); dealloc(cs->auth); @@ -1428,6 +1429,7 @@ static void kill_proxy(ckpool_t *ckp, proxy_instance_t *proxi) LOGNOTICE("Killing proxy"); cs = proxi->cs; Close(cs->fd); + empty_buffer(cs); /* All our notify data is invalid if we reconnect so discard them */ mutex_lock(&proxi->notify_lock);