|
|
|
@ -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) |
|
|
|
|