|
|
@ -180,6 +180,7 @@ struct user_instance { |
|
|
|
double dsps1440; |
|
|
|
double dsps1440; |
|
|
|
double dsps10080; |
|
|
|
double dsps10080; |
|
|
|
tv_t last_share; |
|
|
|
tv_t last_share; |
|
|
|
|
|
|
|
time_t auth_time; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/* Combined data from workers with the same workername */ |
|
|
|
/* Combined data from workers with the same workername */ |
|
|
@ -1981,6 +1982,8 @@ static int send_recv_auth(stratum_instance_t *client) |
|
|
|
json_get_string(&secondaryuserid, val, "secondaryuserid"); |
|
|
|
json_get_string(&secondaryuserid, val, "secondaryuserid"); |
|
|
|
json_get_int(&worker->mindiff, val, "difficultydefault"); |
|
|
|
json_get_int(&worker->mindiff, val, "difficultydefault"); |
|
|
|
client->suggest_diff = worker->mindiff; |
|
|
|
client->suggest_diff = worker->mindiff; |
|
|
|
|
|
|
|
if (!user_instance->auth_time) |
|
|
|
|
|
|
|
user_instance->auth_time = time(NULL); |
|
|
|
} |
|
|
|
} |
|
|
|
if (secondaryuserid && (!safecmp(response, "ok.authorise") || |
|
|
|
if (secondaryuserid && (!safecmp(response, "ok.authorise") || |
|
|
|
!safecmp(response, "ok.addrauth"))) { |
|
|
|
!safecmp(response, "ok.addrauth"))) { |
|
|
@ -2082,6 +2085,12 @@ static json_t *parse_authorise(stratum_instance_t *client, json_t *params_val, j |
|
|
|
if (CKP_STANDALONE(ckp)) |
|
|
|
if (CKP_STANDALONE(ckp)) |
|
|
|
ret = true; |
|
|
|
ret = true; |
|
|
|
else { |
|
|
|
else { |
|
|
|
|
|
|
|
/* Preauth workers for the first 10 minutes after the user is
|
|
|
|
|
|
|
|
* first authorised by ckdb to avoid floods of worker auths. |
|
|
|
|
|
|
|
* *errnum is implied zero already so ret will be set true */ |
|
|
|
|
|
|
|
if (user_instance->auth_time && time(NULL) - user_instance->auth_time < 600) |
|
|
|
|
|
|
|
queue_delayed_auth(client); |
|
|
|
|
|
|
|
else |
|
|
|
*errnum = send_recv_auth(client); |
|
|
|
*errnum = send_recv_auth(client); |
|
|
|
if (!*errnum) |
|
|
|
if (!*errnum) |
|
|
|
ret = true; |
|
|
|
ret = true; |
|
|
|