From 259f8ca4a0094e38f93e5a6c4eaa7928f378c096 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 13 Jan 2015 16:49:16 +1100 Subject: [PATCH] Use invalidate in the connector when dropping a client to ensure the stratifier drops it as well Conflicts: src/connector.c --- src/connector.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/connector.c b/src/connector.c index 2a4b9b64..811e20b1 100644 --- a/src/connector.c +++ b/src/connector.c @@ -236,13 +236,14 @@ static void stratifier_drop_client(ckpool_t *ckp, int64_t id) * regularly but keep the instances in a linked list until their ref count * drops to zero when we can remove them lazily. Client must hold a reference * count. */ -static void invalidate_client(ckpool_t *ckp, cdata_t *cdata, client_instance_t *client) +static int invalidate_client(ckpool_t *ckp, cdata_t *cdata, client_instance_t *client) { client_instance_t *tmp, *client_delete = NULL; + int ret; - drop_client(cdata, client); + ret = drop_client(cdata, client); if (ckp->passthrough) - return; + goto out; stratifier_drop_client(ckp, client->id); /* Cull old unused clients lazily when there are no more reference @@ -259,6 +260,9 @@ static void invalidate_client(ckpool_t *ckp, cdata_t *cdata, client_instance_t * } dealloc(client_delete); ck_wunlock(&cdata->lock); + +out: + return ret; } static void send_client(cdata_t *cdata, int64_t id, char *buf); @@ -692,7 +696,7 @@ retry: stratifier_drop_client(ckp, client_id); goto retry; } - ret = drop_client(cdata, client); + ret = invalidate_client(ckp, cdata, client); dec_instance_ref(cdata, client); if (ret >= 0) LOGINFO("Connector dropped client id: %ld", client_id);