|
|
@ -1243,7 +1243,6 @@ static void drop_client(sdata_t *sdata, int64_t id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
stratum_instance_t *client, *tmp; |
|
|
|
stratum_instance_t *client, *tmp; |
|
|
|
user_instance_t *instance = NULL; |
|
|
|
user_instance_t *instance = NULL; |
|
|
|
time_t now_t = time(NULL); |
|
|
|
|
|
|
|
ckpool_t *ckp = NULL; |
|
|
|
ckpool_t *ckp = NULL; |
|
|
|
bool dec = false; |
|
|
|
bool dec = false; |
|
|
|
|
|
|
|
|
|
|
@ -1252,14 +1251,16 @@ static void drop_client(sdata_t *sdata, int64_t id) |
|
|
|
ck_wlock(&sdata->instance_lock); |
|
|
|
ck_wlock(&sdata->instance_lock); |
|
|
|
client = __instance_by_id(sdata, id); |
|
|
|
client = __instance_by_id(sdata, id); |
|
|
|
if (client) { |
|
|
|
if (client) { |
|
|
|
stratum_instance_t *old_client = NULL; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (client->authorised) { |
|
|
|
if (client->authorised) { |
|
|
|
dec = true; |
|
|
|
dec = true; |
|
|
|
client->authorised = false; |
|
|
|
client->authorised = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
HASH_DEL(sdata->stratum_instances, client); |
|
|
|
HASH_DEL(sdata->stratum_instances, client); |
|
|
|
|
|
|
|
#if 0 |
|
|
|
|
|
|
|
/* Disable resume support till debugged properly */ |
|
|
|
|
|
|
|
stratum_instance_t *old_client = NULL; |
|
|
|
|
|
|
|
|
|
|
|
HASH_FIND(hh, sdata->disconnected_instances, &client->enonce1_64, sizeof(uint64_t), old_client); |
|
|
|
HASH_FIND(hh, sdata->disconnected_instances, &client->enonce1_64, sizeof(uint64_t), old_client); |
|
|
|
/* Only keep around one copy of the old client in server mode */ |
|
|
|
/* Only keep around one copy of the old client in server mode */ |
|
|
|
if (!client->ckp->proxy && !old_client && client->enonce1_64 && dec) { |
|
|
|
if (!client->ckp->proxy && !old_client && client->enonce1_64 && dec) { |
|
|
@ -1267,12 +1268,16 @@ static void drop_client(sdata_t *sdata, int64_t id) |
|
|
|
sdata->stats.disconnected++; |
|
|
|
sdata->stats.disconnected++; |
|
|
|
client->disconnected_time = time(NULL); |
|
|
|
client->disconnected_time = time(NULL); |
|
|
|
} else |
|
|
|
} else |
|
|
|
|
|
|
|
#endif |
|
|
|
__kill_instance(sdata, client); |
|
|
|
__kill_instance(sdata, client); |
|
|
|
ckp = client->ckp; |
|
|
|
ckp = client->ckp; |
|
|
|
instance = client->user_instance; |
|
|
|
instance = client->user_instance; |
|
|
|
LOGINFO("Stratifer dropped %sauthorised client %ld", dec ? "" : "un", id); |
|
|
|
LOGINFO("Stratifer dropped %sauthorised client %ld", dec ? "" : "un", id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
|
|
|
|
time_t now_t = time(NULL); |
|
|
|
|
|
|
|
|
|
|
|
/* Old disconnected instances will not have any valid shares so remove
|
|
|
|
/* Old disconnected instances will not have any valid shares so remove
|
|
|
|
* them from the disconnected instances list if they've been dead for |
|
|
|
* them from the disconnected instances list if they've been dead for |
|
|
|
* more than 10 minutes */ |
|
|
|
* more than 10 minutes */ |
|
|
@ -1282,6 +1287,7 @@ static void drop_client(sdata_t *sdata, int64_t id) |
|
|
|
LOGINFO("Discarding aged disconnected instance %ld", client->id); |
|
|
|
LOGINFO("Discarding aged disconnected instance %ld", client->id); |
|
|
|
__del_disconnected(sdata, client); |
|
|
|
__del_disconnected(sdata, client); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
/* 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. */ |
|
|
|