|
|
@ -320,6 +320,7 @@ struct stratifier_data { |
|
|
|
ckmsgq_t *stxnq; // Transaction requests
|
|
|
|
ckmsgq_t *stxnq; // Transaction requests
|
|
|
|
|
|
|
|
|
|
|
|
int64_t user_instance_id; |
|
|
|
int64_t user_instance_id; |
|
|
|
|
|
|
|
int64_t highest_client_id; /* Highest known client id */ |
|
|
|
|
|
|
|
|
|
|
|
/* Stratum_instances hashlist is stored by id, whereas disconnected_instances
|
|
|
|
/* Stratum_instances hashlist is stored by id, whereas disconnected_instances
|
|
|
|
* is sorted by enonce1_64. */ |
|
|
|
* is sorted by enonce1_64. */ |
|
|
@ -1173,17 +1174,24 @@ static stratum_instance_t *ref_instance_by_id(sdata_t *sdata, const int64_t id) |
|
|
|
static bool __dropped_instance(sdata_t *sdata, const int64_t id) |
|
|
|
static bool __dropped_instance(sdata_t *sdata, const int64_t id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
stratum_instance_t *client, *tmp; |
|
|
|
stratum_instance_t *client, *tmp; |
|
|
|
bool ret = true; |
|
|
|
bool ret = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Avoid iterating over all the instances if we haven't seen an id this high
|
|
|
|
|
|
|
|
* before as the value only ever increases */ |
|
|
|
|
|
|
|
if (id > sdata->highest_client_id) |
|
|
|
|
|
|
|
goto out; |
|
|
|
HASH_ITER(hh, sdata->disconnected_instances, client, tmp) { |
|
|
|
HASH_ITER(hh, sdata->disconnected_instances, client, tmp) { |
|
|
|
if (unlikely(client->id == id)) |
|
|
|
if (unlikely(client->id == id)) { |
|
|
|
|
|
|
|
ret = true; |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
DL_FOREACH(sdata->dead_instances, client) { |
|
|
|
DL_FOREACH(sdata->dead_instances, client) { |
|
|
|
if (unlikely(client->id == id)) |
|
|
|
if (unlikely(client->id == id)) { |
|
|
|
|
|
|
|
ret = true; |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
ret = false; |
|
|
|
|
|
|
|
out: |
|
|
|
out: |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
@ -1264,6 +1272,8 @@ static stratum_instance_t *__stratum_add_instance(ckpool_t *ckp, const int64_t i |
|
|
|
|
|
|
|
|
|
|
|
sdata->stratum_generated++; |
|
|
|
sdata->stratum_generated++; |
|
|
|
client->id = id; |
|
|
|
client->id = id; |
|
|
|
|
|
|
|
if (id > sdata->highest_client_id) |
|
|
|
|
|
|
|
sdata->highest_client_id = id; |
|
|
|
client->server = server; |
|
|
|
client->server = server; |
|
|
|
client->diff = client->old_diff = ckp->startdiff; |
|
|
|
client->diff = client->old_diff = ckp->startdiff; |
|
|
|
client->ckp = ckp; |
|
|
|
client->ckp = ckp; |
|
|
|