|
|
@ -1322,7 +1322,7 @@ static uint64_t disconnected_sessionid_exists(sdata_t *sdata, const char *sessio |
|
|
|
} |
|
|
|
} |
|
|
|
client = NULL; |
|
|
|
client = NULL; |
|
|
|
HASH_FIND(hh, sdata->disconnected_instances, &enonce1_64, sizeof(uint64_t), client); |
|
|
|
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
|
|
|
|
/* Delete the entry once we are going to use it since there
|
|
|
|
* will be a new instance with the enonce1_64 */ |
|
|
|
* will be a new instance with the enonce1_64 */ |
|
|
|
old_id = client->id; |
|
|
|
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) |
|
|
|
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; |
|
|
|
stratum_instance_t *client, *tmp; |
|
|
|
user_instance_t *user = NULL; |
|
|
|
user_instance_t *user = NULL; |
|
|
|
time_t now_t = time(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) { |
|
|
|
HASH_ITER(hh, sdata->disconnected_instances, client, tmp) { |
|
|
|
if (now_t - client->disconnected_time < 600) |
|
|
|
if (now_t - client->disconnected_time < 600) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
if (unlikely(client->ref)) { |
|
|
|
|
|
|
|
disref++; |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
aged++; |
|
|
|
aged++; |
|
|
|
__del_disconnected(sdata, client); |
|
|
|
__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
|
|
|
|
/* Cull old unused clients lazily when there are no more reference
|
|
|
|
* counts for them. */ |
|
|
|
* counts for them. */ |
|
|
|
DL_FOREACH_SAFE(sdata->dead_instances, client, tmp) { |
|
|
|
DL_FOREACH_SAFE(sdata->dead_instances, client, tmp) { |
|
|
|
if (unlikely(client->ref)) { |
|
|
|
|
|
|
|
deadref++; |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
killed++; |
|
|
|
killed++; |
|
|
|
__del_dead(sdata, client); |
|
|
|
__del_dead(sdata, client); |
|
|
|
free(client->workername); |
|
|
|
free(client->workername); |
|
|
@ -1473,14 +1465,6 @@ static void drop_client(sdata_t *sdata, const int64_t id) |
|
|
|
ck_wunlock(&sdata->instance_lock); |
|
|
|
ck_wunlock(&sdata->instance_lock); |
|
|
|
|
|
|
|
|
|
|
|
client_drop_message(id, dropped, false); |
|
|
|
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) |
|
|
|
if (aged) |
|
|
|
LOGINFO("Aged %d disconnected instances to dead", aged); |
|
|
|
LOGINFO("Aged %d disconnected instances to dead", aged); |
|
|
|
if (killed) |
|
|
|
if (killed) |
|
|
|