From 8eee70a4a51d3127f48fdb105b4145d0690e2e78 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 16 Jan 2015 14:38:06 +1100 Subject: [PATCH] Do not delete the worker instance linked list on removing the worker from the list --- src/stratifier.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index 53f16551..c04aa3f3 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -1113,7 +1113,7 @@ static stratum_instance_t *__stratum_add_instance(ckpool_t *ckp, int64_t id, int } /* Add a stratum instance to the dead instances list */ -static void kill_instance(sdata_t *sdata, stratum_instance_t *client) +static void __kill_instance(sdata_t *sdata, stratum_instance_t *client) { user_instance_t *instance = client->user_instance; @@ -1121,10 +1121,8 @@ static void kill_instance(sdata_t *sdata, stratum_instance_t *client) worker_instance_t *worker = client->worker_instance; DL_DELETE(instance->instances, client); - if (worker) { + if (worker) DL_DELETE(instance->worker_instances, worker); - free(worker); - } } LL_PREPEND(sdata->dead_instances, client); sdata->stats.dead++; @@ -1159,7 +1157,7 @@ static bool disconnected_sessionid_exists(sdata_t *sdata, const char *sessionid, /* If we've found a matching disconnected instance, use it only * once and discard it */ __del_disconnected(sdata, instance); - kill_instance(sdata, instance); + __kill_instance(sdata, instance); ret = true; } out_unlock: @@ -1270,7 +1268,7 @@ static void drop_client(sdata_t *sdata, int64_t id) sdata->stats.disconnected++; client->disconnected_time = time(NULL); } else - kill_instance(sdata, client); + __kill_instance(sdata, client); } ck_wunlock(&sdata->instance_lock); @@ -1292,7 +1290,7 @@ static void drop_client(sdata_t *sdata, int64_t id) continue; LOGINFO("Discarding aged disconnected instance %ld", client->id); __del_disconnected(sdata, client); - kill_instance(sdata, client); + __kill_instance(sdata, client); } /* Discard any dead instances that no longer hold any reference counts, * freeing up their memory safely */