From 71917ed4dac13a94b566de0f0b18b00314855b49 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 26 Jan 2015 14:08:41 +1100 Subject: [PATCH] Do not send messages from the connector of clients we've already dropped --- src/connector.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/connector.c b/src/connector.c index be846e60..f47e30b0 100644 --- a/src/connector.c +++ b/src/connector.c @@ -351,10 +351,17 @@ reparse: json_object_set_new_nocheck(val, "address", json_string(client->address_name)); json_object_set_new_nocheck(val, "server", json_integer(client->server)); s = json_dumps(val, 0); - if (ckp->passthrough) - send_proc(ckp->generator, s); - else - send_proc(ckp->stratifier, s); + + ck_rlock(&cdata->lock); + /* Do not send messages of clients we've already dropped */ + if (likely(client->fd != -1)) { + if (ckp->passthrough) + send_proc(ckp->generator, s); + else + send_proc(ckp->stratifier, s); + } + ck_runlock(&cdata->lock); + free(s); json_decref(val); }