|
|
@ -939,7 +939,7 @@ static void drop_allclients(ckpool_t *ckp) |
|
|
|
HASH_DEL(sdata->stratum_instances, client); |
|
|
|
HASH_DEL(sdata->stratum_instances, client); |
|
|
|
__kill_instance(client); |
|
|
|
__kill_instance(client); |
|
|
|
kills++; |
|
|
|
kills++; |
|
|
|
sprintf(buf, "dropclient=%ld", client->id); |
|
|
|
sprintf(buf, "dropclient=%"PRId64, client->id); |
|
|
|
send_proc(ckp->connector, buf); |
|
|
|
send_proc(ckp->connector, buf); |
|
|
|
} |
|
|
|
} |
|
|
|
HASH_ITER(hh, sdata->disconnected_instances, client, tmp) { |
|
|
|
HASH_ITER(hh, sdata->disconnected_instances, client, tmp) { |
|
|
@ -1226,13 +1226,13 @@ static void client_drop_message(const int64_t client_id, const int dropped, cons |
|
|
|
case 0: |
|
|
|
case 0: |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
case 1: |
|
|
|
LOGNOTICE("Client %ld disconnected %s", client_id, lazily ? "lazily" : ""); |
|
|
|
LOGNOTICE("Client %"PRId64" disconnected %s", client_id, lazily ? "lazily" : ""); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
case 2: |
|
|
|
LOGNOTICE("Client %ld dropped %s", client_id, lazily ? "lazily" : ""); |
|
|
|
LOGNOTICE("Client %"PRId64" dropped %s", client_id, lazily ? "lazily" : ""); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
case 3: |
|
|
|
LOGNOTICE("Workerless client %ld dropped %s", client_id, lazily ? "lazily" : ""); |
|
|
|
LOGNOTICE("Workerless client %"PRId64" dropped %s", client_id, lazily ? "lazily" : ""); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1323,7 +1323,7 @@ out_unlock: |
|
|
|
ck_uilock(&sdata->instance_lock); |
|
|
|
ck_uilock(&sdata->instance_lock); |
|
|
|
out: |
|
|
|
out: |
|
|
|
if (ret) |
|
|
|
if (ret) |
|
|
|
LOGNOTICE("Reconnecting old instance %ld to instance %ld", old_id, id); |
|
|
|
LOGNOTICE("Reconnecting old instance %"PRId64" to instance %"PRId64, old_id, id); |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1413,7 +1413,7 @@ static void drop_client(sdata_t *sdata, const int64_t id) |
|
|
|
time_t now_t = time(NULL); |
|
|
|
time_t now_t = time(NULL); |
|
|
|
ckpool_t *ckp = NULL; |
|
|
|
ckpool_t *ckp = NULL; |
|
|
|
|
|
|
|
|
|
|
|
LOGINFO("Stratifier asked to drop client %ld", id); |
|
|
|
LOGINFO("Stratifier asked to drop client %"PRId64, id); |
|
|
|
|
|
|
|
|
|
|
|
ck_ilock(&sdata->instance_lock); |
|
|
|
ck_ilock(&sdata->instance_lock); |
|
|
|
client = __instance_by_id(sdata, id); |
|
|
|
client = __instance_by_id(sdata, id); |
|
|
@ -1781,7 +1781,7 @@ retry: |
|
|
|
} else if (cmdmatch(buf, "dropclient")) { |
|
|
|
} else if (cmdmatch(buf, "dropclient")) { |
|
|
|
int64_t client_id; |
|
|
|
int64_t client_id; |
|
|
|
|
|
|
|
|
|
|
|
ret = sscanf(buf, "dropclient=%ld", &client_id); |
|
|
|
ret = sscanf(buf, "dropclient=%"PRId64, &client_id); |
|
|
|
if (ret < 0) |
|
|
|
if (ret < 0) |
|
|
|
LOGDEBUG("Stratifier failed to parse dropclient command: %s", buf); |
|
|
|
LOGDEBUG("Stratifier failed to parse dropclient command: %s", buf); |
|
|
|
else |
|
|
|
else |
|
|
@ -1987,10 +1987,10 @@ static json_t *parse_subscribe(stratum_instance_t *client, const int64_t client_ |
|
|
|
client->reject = 2; |
|
|
|
client->reject = 2; |
|
|
|
return json_string("proxy full"); |
|
|
|
return json_string("proxy full"); |
|
|
|
} |
|
|
|
} |
|
|
|
LOGINFO("Set new subscription %ld to new enonce1 %lx string %s", client->id, |
|
|
|
LOGINFO("Set new subscription %"PRId64" to new enonce1 %lx string %s", client->id, |
|
|
|
client->enonce1_64, client->enonce1); |
|
|
|
client->enonce1_64, client->enonce1); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
LOGINFO("Set new subscription %ld to old matched enonce1 %lx string %s", |
|
|
|
LOGINFO("Set new subscription %"PRId64" to old matched enonce1 %lx string %s", |
|
|
|
client->id, client->enonce1_64, client->enonce1); |
|
|
|
client->id, client->enonce1_64, client->enonce1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2421,7 +2421,7 @@ static json_t *parse_authorise(stratum_instance_t *client, const json_t *params_ |
|
|
|
time_t now_t = time(NULL); |
|
|
|
time_t now_t = time(NULL); |
|
|
|
|
|
|
|
|
|
|
|
if (now_t < user->failed_authtime + user->auth_backoff) { |
|
|
|
if (now_t < user->failed_authtime + user->auth_backoff) { |
|
|
|
LOGNOTICE("Client %ld worker %s rate limited due to failed auth attempts", |
|
|
|
LOGNOTICE("Client %"PRId64" worker %s rate limited due to failed auth attempts", |
|
|
|
client->id, buf); |
|
|
|
client->id, buf); |
|
|
|
client->dropped = true; |
|
|
|
client->dropped = true; |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
@ -2453,11 +2453,11 @@ static json_t *parse_authorise(stratum_instance_t *client, const json_t *params_ |
|
|
|
if (ret) { |
|
|
|
if (ret) { |
|
|
|
client->authorised = ret; |
|
|
|
client->authorised = ret; |
|
|
|
user->authorised = ret; |
|
|
|
user->authorised = ret; |
|
|
|
LOGNOTICE("Authorised client %ld worker %s as user %s", client->id, buf, |
|
|
|
LOGNOTICE("Authorised client %"PRId64" worker %s as user %s", client->id, buf, |
|
|
|
user->username); |
|
|
|
user->username); |
|
|
|
user->auth_backoff = 3; /* Reset auth backoff time */ |
|
|
|
user->auth_backoff = 3; /* Reset auth backoff time */ |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
LOGNOTICE("Client %ld worker %s failed to authorise as user %s", client->id, buf, |
|
|
|
LOGNOTICE("Client %"PRId64" worker %s failed to authorise as user %s", client->id, buf, |
|
|
|
user->username); |
|
|
|
user->username); |
|
|
|
user->failed_authtime = time(NULL); |
|
|
|
user->failed_authtime = time(NULL); |
|
|
|
user->auth_backoff <<= 1; |
|
|
|
user->auth_backoff <<= 1; |
|
|
@ -2631,7 +2631,7 @@ static void add_submit(ckpool_t *ckp, stratum_instance_t *client, const int diff |
|
|
|
|
|
|
|
|
|
|
|
client->ssdc = 0; |
|
|
|
client->ssdc = 0; |
|
|
|
|
|
|
|
|
|
|
|
LOGINFO("Client %ld biased dsps %.2f dsps %.2f drr %.2f adjust diff from %ld to: %ld ", |
|
|
|
LOGINFO("Client %"PRId64" biased dsps %.2f dsps %.2f drr %.2f adjust diff from %"PRId64" to: %"PRId64" ", |
|
|
|
client->id, dsps, client->dsps5, drr, client->diff, optimal); |
|
|
|
client->id, dsps, client->dsps5, drr, client->diff, optimal); |
|
|
|
|
|
|
|
|
|
|
|
copy_tv(&client->ldc, &now_t); |
|
|
|
copy_tv(&client->ldc, &now_t); |
|
|
@ -2946,7 +2946,7 @@ static json_t *parse_submit(stratum_instance_t *client, json_t *json_msg, |
|
|
|
worker_instance_t *worker = client->worker_instance; |
|
|
|
worker_instance_t *worker = client->worker_instance; |
|
|
|
|
|
|
|
|
|
|
|
client->best_diff = sdiff; |
|
|
|
client->best_diff = sdiff; |
|
|
|
LOGINFO("User %s worker %s client %ld new best diff %lf", user->username, |
|
|
|
LOGINFO("User %s worker %s client %"PRId64" new best diff %lf", user->username, |
|
|
|
worker->workername, client->id, sdiff); |
|
|
|
worker->workername, client->id, sdiff); |
|
|
|
if (sdiff > worker->best_diff) |
|
|
|
if (sdiff > worker->best_diff) |
|
|
|
worker->best_diff = sdiff; |
|
|
|
worker->best_diff = sdiff; |
|
|
@ -2983,25 +2983,25 @@ out_unlock: |
|
|
|
suffix_string(wdiff, wdiffsuffix, 16, 0); |
|
|
|
suffix_string(wdiff, wdiffsuffix, 16, 0); |
|
|
|
if (sdiff >= diff) { |
|
|
|
if (sdiff >= diff) { |
|
|
|
if (new_share(sdata, hash, id)) { |
|
|
|
if (new_share(sdata, hash, id)) { |
|
|
|
LOGINFO("Accepted client %ld share diff %.1f/%.0f/%s: %s", |
|
|
|
LOGINFO("Accepted client %"PRId64" share diff %.1f/%.0f/%s: %s", |
|
|
|
client->id, sdiff, diff, wdiffsuffix, hexhash); |
|
|
|
client->id, sdiff, diff, wdiffsuffix, hexhash); |
|
|
|
result = true; |
|
|
|
result = true; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
err = SE_DUPE; |
|
|
|
err = SE_DUPE; |
|
|
|
json_set_string(json_msg, "reject-reason", SHARE_ERR(err)); |
|
|
|
json_set_string(json_msg, "reject-reason", SHARE_ERR(err)); |
|
|
|
LOGINFO("Rejected client %ld dupe diff %.1f/%.0f/%s: %s", |
|
|
|
LOGINFO("Rejected client %"PRId64" dupe diff %.1f/%.0f/%s: %s", |
|
|
|
client->id, sdiff, diff, wdiffsuffix, hexhash); |
|
|
|
client->id, sdiff, diff, wdiffsuffix, hexhash); |
|
|
|
submit = false; |
|
|
|
submit = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
err = SE_HIGH_DIFF; |
|
|
|
err = SE_HIGH_DIFF; |
|
|
|
LOGINFO("Rejected client %ld high diff %.1f/%.0f/%s: %s", |
|
|
|
LOGINFO("Rejected client %"PRId64" high diff %.1f/%.0f/%s: %s", |
|
|
|
client->id, sdiff, diff, wdiffsuffix, hexhash); |
|
|
|
client->id, sdiff, diff, wdiffsuffix, hexhash); |
|
|
|
json_set_string(json_msg, "reject-reason", SHARE_ERR(err)); |
|
|
|
json_set_string(json_msg, "reject-reason", SHARE_ERR(err)); |
|
|
|
submit = false; |
|
|
|
submit = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} else |
|
|
|
} else |
|
|
|
LOGINFO("Rejected client %ld invalid share", client->id); |
|
|
|
LOGINFO("Rejected client %"PRId64" invalid share", client->id); |
|
|
|
|
|
|
|
|
|
|
|
/* Submit share to upstream pool in proxy mode. We submit valid and
|
|
|
|
/* Submit share to upstream pool in proxy mode. We submit valid and
|
|
|
|
* stale shares and filter out the rest. */ |
|
|
|
* stale shares and filter out the rest. */ |
|
|
@ -3056,12 +3056,12 @@ out: |
|
|
|
if (client->first_invalid < client->last_share.tv_sec || !client->first_invalid) |
|
|
|
if (client->first_invalid < client->last_share.tv_sec || !client->first_invalid) |
|
|
|
client->first_invalid = now_t; |
|
|
|
client->first_invalid = now_t; |
|
|
|
else if (client->first_invalid && client->first_invalid < now_t - 120) { |
|
|
|
else if (client->first_invalid && client->first_invalid < now_t - 120) { |
|
|
|
LOGNOTICE("Client %ld rejecting for 120s, disconnecting", client->id); |
|
|
|
LOGNOTICE("Client %"PRId64" rejecting for 120s, disconnecting", client->id); |
|
|
|
stratum_send_message(sdata, client, "Disconnecting for continuous invalid shares"); |
|
|
|
stratum_send_message(sdata, client, "Disconnecting for continuous invalid shares"); |
|
|
|
client->reject = 2; |
|
|
|
client->reject = 2; |
|
|
|
} else if (client->first_invalid && client->first_invalid < now_t - 60) { |
|
|
|
} else if (client->first_invalid && client->first_invalid < now_t - 60) { |
|
|
|
if (!client->reject) { |
|
|
|
if (!client->reject) { |
|
|
|
LOGINFO("Client %ld rejecting for 60s, sending update", client->id); |
|
|
|
LOGINFO("Client %"PRId64" rejecting for 60s, sending update", client->id); |
|
|
|
update_client(sdata, client, client->id); |
|
|
|
update_client(sdata, client, client->id); |
|
|
|
client->reject = 1; |
|
|
|
client->reject = 1; |
|
|
|
} |
|
|
|
} |
|
|
@ -3087,7 +3087,7 @@ out: |
|
|
|
json_set_string(val, "createcode", __func__); |
|
|
|
json_set_string(val, "createcode", __func__); |
|
|
|
json_set_string(val, "createinet", ckp->serverurl[client->server]); |
|
|
|
json_set_string(val, "createinet", ckp->serverurl[client->server]); |
|
|
|
ckdbq_add(ckp, ID_SHAREERR, val); |
|
|
|
ckdbq_add(ckp, ID_SHAREERR, val); |
|
|
|
LOGINFO("Invalid share from client %ld: %s", client->id, client->workername); |
|
|
|
LOGINFO("Invalid share from client %"PRId64": %s", client->id, client->workername); |
|
|
|
} |
|
|
|
} |
|
|
|
free(fname); |
|
|
|
free(fname); |
|
|
|
return json_boolean(result); |
|
|
|
return json_boolean(result); |
|
|
@ -3243,12 +3243,12 @@ static void suggest_diff(stratum_instance_t *client, const char *method, const j |
|
|
|
int64_t sdiff; |
|
|
|
int64_t sdiff; |
|
|
|
|
|
|
|
|
|
|
|
if (unlikely(!client->authorised)) { |
|
|
|
if (unlikely(!client->authorised)) { |
|
|
|
LOGWARNING("Attempted to suggest diff on unauthorised client %ld", client->id); |
|
|
|
LOGWARNING("Attempted to suggest diff on unauthorised client %"PRId64, client->id); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (arr_val && json_is_integer(arr_val)) |
|
|
|
if (arr_val && json_is_integer(arr_val)) |
|
|
|
sdiff = json_integer_value(arr_val); |
|
|
|
sdiff = json_integer_value(arr_val); |
|
|
|
else if (sscanf(method, "mining.suggest_difficulty(%ld", &sdiff) != 1) { |
|
|
|
else if (sscanf(method, "mining.suggest_difficulty(%"PRId64, &sdiff) != 1) { |
|
|
|
LOGINFO("Failed to parse suggest_difficulty for client %"PRId64, client->id); |
|
|
|
LOGINFO("Failed to parse suggest_difficulty for client %"PRId64, client->id); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -3286,7 +3286,7 @@ static void parse_method(sdata_t *sdata, stratum_instance_t *client, const int64 |
|
|
|
json_t *val, *result_val; |
|
|
|
json_t *val, *result_val; |
|
|
|
|
|
|
|
|
|
|
|
if (unlikely(client->subscribed)) { |
|
|
|
if (unlikely(client->subscribed)) { |
|
|
|
LOGNOTICE("Client %ld trying to subscribe twice", client_id); |
|
|
|
LOGNOTICE("Client %"PRId64" trying to subscribe twice", client_id); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
result_val = parse_subscribe(client, client_id, params_val); |
|
|
|
result_val = parse_subscribe(client, client_id, params_val); |
|
|
@ -3306,21 +3306,21 @@ static void parse_method(sdata_t *sdata, stratum_instance_t *client, const int64 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (unlikely(cmdmatch(method, "mining.passthrough"))) { |
|
|
|
if (unlikely(cmdmatch(method, "mining.passthrough"))) { |
|
|
|
LOGNOTICE("Adding passthrough client %ld", client_id); |
|
|
|
LOGNOTICE("Adding passthrough client %"PRId64, client_id); |
|
|
|
/* We need to inform the connector process that this client
|
|
|
|
/* We need to inform the connector process that this client
|
|
|
|
* is a passthrough and to manage its messages accordingly. |
|
|
|
* is a passthrough and to manage its messages accordingly. |
|
|
|
* The client_id stays on the list but we won't send anything |
|
|
|
* The client_id stays on the list but we won't send anything |
|
|
|
* to it since it's unauthorised. Set the flag just in case. */ |
|
|
|
* to it since it's unauthorised. Set the flag just in case. */ |
|
|
|
client->authorised = false; |
|
|
|
client->authorised = false; |
|
|
|
snprintf(buf, 255, "passthrough=%ld", client_id); |
|
|
|
snprintf(buf, 255, "passthrough=%"PRId64, client_id); |
|
|
|
send_proc(client->ckp->connector, buf); |
|
|
|
send_proc(client->ckp->connector, buf); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* We should only accept subscribed requests from here on */ |
|
|
|
/* We should only accept subscribed requests from here on */ |
|
|
|
if (!client->subscribed) { |
|
|
|
if (!client->subscribed) { |
|
|
|
LOGINFO("Dropping unsubscribed client %ld", client_id); |
|
|
|
LOGINFO("Dropping unsubscribed client %"PRId64, client_id); |
|
|
|
snprintf(buf, 255, "dropclient=%ld", client_id); |
|
|
|
snprintf(buf, 255, "dropclient=%"PRId64, client_id); |
|
|
|
send_proc(client->ckp->connector, buf); |
|
|
|
send_proc(client->ckp->connector, buf); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -3329,7 +3329,7 @@ static void parse_method(sdata_t *sdata, stratum_instance_t *client, const int64 |
|
|
|
json_params_t *jp; |
|
|
|
json_params_t *jp; |
|
|
|
|
|
|
|
|
|
|
|
if (unlikely(client->authorised)) { |
|
|
|
if (unlikely(client->authorised)) { |
|
|
|
LOGNOTICE("Client %ld trying to authorise twice", client_id); |
|
|
|
LOGNOTICE("Client %"PRId64" trying to authorise twice", client_id); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
jp = create_json_params(client_id, method_val, params_val, id_val, address); |
|
|
|
jp = create_json_params(client_id, method_val, params_val, id_val, address); |
|
|
@ -3342,8 +3342,8 @@ static void parse_method(sdata_t *sdata, stratum_instance_t *client, const int64 |
|
|
|
/* Dropping unauthorised clients here also allows the
|
|
|
|
/* Dropping unauthorised clients here also allows the
|
|
|
|
* stratifier process to restart since it will have lost all |
|
|
|
* stratifier process to restart since it will have lost all |
|
|
|
* the stratum instance data. Clients will just reconnect. */ |
|
|
|
* the stratum instance data. Clients will just reconnect. */ |
|
|
|
LOGINFO("Dropping unauthorised client %ld", client_id); |
|
|
|
LOGINFO("Dropping unauthorised client %"PRId64, client_id); |
|
|
|
snprintf(buf, 255, "dropclient=%ld", client_id); |
|
|
|
snprintf(buf, 255, "dropclient=%"PRId64, client_id); |
|
|
|
send_proc(client->ckp->connector, buf); |
|
|
|
send_proc(client->ckp->connector, buf); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -3361,7 +3361,7 @@ static void parse_method(sdata_t *sdata, stratum_instance_t *client, const int64 |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
/* Unhandled message here */ |
|
|
|
/* Unhandled message here */ |
|
|
|
LOGINFO("Unhandled client %ld method %s", client_id, method); |
|
|
|
LOGINFO("Unhandled client %"PRId64" method %s", client_id, method); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -3380,7 +3380,7 @@ static void parse_instance_msg(sdata_t *sdata, smsg_t *msg, stratum_instance_t * |
|
|
|
|
|
|
|
|
|
|
|
if (unlikely(client->reject == 2)) { |
|
|
|
if (unlikely(client->reject == 2)) { |
|
|
|
LOGINFO("Dropping client %"PRId64" tagged for lazy invalidation", client_id); |
|
|
|
LOGINFO("Dropping client %"PRId64" tagged for lazy invalidation", client_id); |
|
|
|
snprintf(buf, 255, "dropclient=%ld", client_id); |
|
|
|
snprintf(buf, 255, "dropclient=%"PRId64, client_id); |
|
|
|
send_proc(client->ckp->connector, buf); |
|
|
|
send_proc(client->ckp->connector, buf); |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
@ -3483,13 +3483,13 @@ static void srecv_process(ckpool_t *ckp, char *buf) |
|
|
|
|
|
|
|
|
|
|
|
if (unlikely(dropped)) { |
|
|
|
if (unlikely(dropped)) { |
|
|
|
/* Client may be NULL here */ |
|
|
|
/* Client may be NULL here */ |
|
|
|
LOGNOTICE("Stratifier skipped dropped instance %ld message from server %d", |
|
|
|
LOGNOTICE("Stratifier skipped dropped instance %"PRId64" message from server %d", |
|
|
|
msg->client_id, server); |
|
|
|
msg->client_id, server); |
|
|
|
free_smsg(msg); |
|
|
|
free_smsg(msg); |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
if (unlikely(noid)) |
|
|
|
if (unlikely(noid)) |
|
|
|
LOGINFO("Stratifier added instance %ld server %d", client->id, server); |
|
|
|
LOGINFO("Stratifier added instance %"PRId64" server %d", client->id, server); |
|
|
|
|
|
|
|
|
|
|
|
parse_instance_msg(sdata, msg, client); |
|
|
|
parse_instance_msg(sdata, msg, client); |
|
|
|
dec_instance_ref(sdata, client); |
|
|
|
dec_instance_ref(sdata, client); |
|
|
@ -3535,11 +3535,11 @@ static void sshare_process(ckpool_t *ckp, json_params_t *jp) |
|
|
|
|
|
|
|
|
|
|
|
client = ref_instance_by_id(sdata, client_id); |
|
|
|
client = ref_instance_by_id(sdata, client_id); |
|
|
|
if (unlikely(!client)) { |
|
|
|
if (unlikely(!client)) { |
|
|
|
LOGINFO("Share processor failed to find client id %ld in hashtable!", client_id); |
|
|
|
LOGINFO("Share processor failed to find client id %"PRId64" in hashtable!", client_id); |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
if (unlikely(!client->authorised)) { |
|
|
|
if (unlikely(!client->authorised)) { |
|
|
|
LOGDEBUG("Client %ld no longer authorised to submit shares", client_id); |
|
|
|
LOGDEBUG("Client %"PRId64" no longer authorised to submit shares", client_id); |
|
|
|
goto out_decref; |
|
|
|
goto out_decref; |
|
|
|
} |
|
|
|
} |
|
|
|
json_msg = json_object(); |
|
|
|
json_msg = json_object(); |
|
|
@ -3590,7 +3590,7 @@ static void sauth_process(ckpool_t *ckp, json_params_t *jp) |
|
|
|
|
|
|
|
|
|
|
|
client = preauth_ref_instance_by_id(sdata, client_id); |
|
|
|
client = preauth_ref_instance_by_id(sdata, client_id); |
|
|
|
if (unlikely(!client)) { |
|
|
|
if (unlikely(!client)) { |
|
|
|
LOGINFO("Authoriser failed to find client id %ld in hashtable!", client_id); |
|
|
|
LOGINFO("Authoriser failed to find client id %"PRId64" in hashtable!", client_id); |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -3795,14 +3795,14 @@ static void send_transactions(ckpool_t *ckp, json_params_t *jp) |
|
|
|
|
|
|
|
|
|
|
|
client = ref_instance_by_id(sdata, jp->client_id); |
|
|
|
client = ref_instance_by_id(sdata, jp->client_id); |
|
|
|
if (unlikely(!client)) { |
|
|
|
if (unlikely(!client)) { |
|
|
|
LOGINFO("send_transactions failed to find client id %ld in hashtable!", |
|
|
|
LOGINFO("send_transactions failed to find client id %"PRId64" in hashtable!", |
|
|
|
jp->client_id); |
|
|
|
jp->client_id); |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
now_t = time(NULL); |
|
|
|
now_t = time(NULL); |
|
|
|
if (now_t - client->last_txns < ckp->update_interval) { |
|
|
|
if (now_t - client->last_txns < ckp->update_interval) { |
|
|
|
LOGNOTICE("Rate limiting get_txnhashes on client %ld!", jp->client_id); |
|
|
|
LOGNOTICE("Rate limiting get_txnhashes on client %"PRId64"!", jp->client_id); |
|
|
|
json_set_string(val, "error", "Ratelimit"); |
|
|
|
json_set_string(val, "error", "Ratelimit"); |
|
|
|
goto out_send; |
|
|
|
goto out_send; |
|
|
|
} |
|
|
|
} |
|
|
|