From f6ac71033c8abbb02b57d85442630a7c177a773e Mon Sep 17 00:00:00 2001 From: ckolivas Date: Mon, 2 Feb 2015 13:15:26 +1100 Subject: [PATCH] Disconnected and dead clients can't be holding a reference --- src/stratifier.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index 836e7a63..bbbc2a98 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -1322,7 +1322,7 @@ static uint64_t disconnected_sessionid_exists(sdata_t *sdata, const char *sessio } client = NULL; HASH_FIND(hh, sdata->disconnected_instances, &enonce1_64, sizeof(uint64_t), client); - if (client && !client->ref) { + if (client) { /* Delete the entry once we are going to use it since there * will be a new instance with the enonce1_64 */ old_id = client->id; @@ -1417,7 +1417,7 @@ static void dec_worker(ckpool_t *ckp, user_instance_t *instance) static void drop_client(sdata_t *sdata, const int64_t id) { - int dropped = 0, aged = 0, killed = 0, disref = 0, deadref = 0; + int dropped = 0, aged = 0, killed = 0; stratum_instance_t *client, *tmp; user_instance_t *user = NULL; time_t now_t = time(NULL); @@ -1449,10 +1449,6 @@ static void drop_client(sdata_t *sdata, const int64_t id) HASH_ITER(hh, sdata->disconnected_instances, client, tmp) { if (now_t - client->disconnected_time < 600) continue; - if (unlikely(client->ref)) { - disref++; - continue; - } aged++; __del_disconnected(sdata, client); } @@ -1460,10 +1456,6 @@ static void drop_client(sdata_t *sdata, const int64_t id) /* Cull old unused clients lazily when there are no more reference * counts for them. */ DL_FOREACH_SAFE(sdata->dead_instances, client, tmp) { - if (unlikely(client->ref)) { - deadref++; - continue; - } killed++; __del_dead(sdata, client); free(client->workername); @@ -1473,14 +1465,6 @@ static void drop_client(sdata_t *sdata, const int64_t id) ck_wunlock(&sdata->instance_lock); client_drop_message(id, dropped, false); - if (unlikely(disref)) { - LOGNOTICE("%d referenced disconnected %s", disref, - disref > 1 ? "clients exist" : "client exists"); - } - if (unlikely(deadref)) { - LOGNOTICE("%d referenced dead %s", deadref, - deadref > 1 ? "clients exist" : "client exists"); - } if (aged) LOGINFO("Aged %d disconnected instances to dead", aged); if (killed)