From 3ba8e1d6c152e48a922373f1f3a21ba9a85a1a14 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Thu, 11 Jun 2015 20:06:24 +1000 Subject: [PATCH] Hold an extra reference for the redirect_client message in the redirector --- src/connector.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/connector.c b/src/connector.c index 9747d8e7..39e26cdb 100644 --- a/src/connector.c +++ b/src/connector.c @@ -134,6 +134,13 @@ static void __inc_instance_ref(client_instance_t *client) client->ref++; } +static void inc_instance_ref(cdata_t *cdata, client_instance_t *client) +{ + ck_wlock(&cdata->lock); + __inc_instance_ref(client); + ck_wunlock(&cdata->lock); +} + /* Increase the reference count of instance */ static void __dec_instance_ref(client_instance_t *client) { @@ -713,6 +720,7 @@ static void redirect_client(ckpool_t *ckp, client_instance_t *client) sender_send->client = client; sender_send->buf = buf; sender_send->len = strlen(buf); + inc_instance_ref(cdata, client); mutex_lock(&cdata->sender_lock); cdata->sends_generated++;