|
|
@ -420,7 +420,7 @@ static void send_client(cdata_t *cdata, int64_t id, char *buf); |
|
|
|
|
|
|
|
|
|
|
|
/* Look for shares being submitted via a redirector and add them to a linked
|
|
|
|
/* Look for shares being submitted via a redirector and add them to a linked
|
|
|
|
* list for looking up the responses. */ |
|
|
|
* list for looking up the responses. */ |
|
|
|
static void parse_redirector_share(client_instance_t *client, const char *msg, const json_t *val) |
|
|
|
static void parse_redirector_share(client_instance_t *client, const json_t *val) |
|
|
|
{ |
|
|
|
{ |
|
|
|
share_t *share, *tmp; |
|
|
|
share_t *share, *tmp; |
|
|
|
time_t now; |
|
|
|
time_t now; |
|
|
@ -430,19 +430,6 @@ static void parse_redirector_share(client_instance_t *client, const char *msg, c |
|
|
|
LOGNOTICE("Failed to find redirector share id"); |
|
|
|
LOGNOTICE("Failed to find redirector share id"); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
/* If this is not a share, delete any matching ID messages so we
|
|
|
|
|
|
|
|
* don't falsely assume the client has had an accepted share based on |
|
|
|
|
|
|
|
* a true result to a different message. */ |
|
|
|
|
|
|
|
if (!strstr(msg, "mining.submit")) { |
|
|
|
|
|
|
|
LOGDEBUG("Redirector client %"PRId64" non share message: %s", client->id, msg); |
|
|
|
|
|
|
|
DL_FOREACH_SAFE(client->shares, share, tmp) { |
|
|
|
|
|
|
|
if (share->id == id) { |
|
|
|
|
|
|
|
DL_DELETE(client->shares, share); |
|
|
|
|
|
|
|
dealloc(share); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
share = ckzalloc(sizeof(share_t)); |
|
|
|
share = ckzalloc(sizeof(share_t)); |
|
|
|
now = time(NULL); |
|
|
|
now = time(NULL); |
|
|
|
share->submitted = now; |
|
|
|
share->submitted = now; |
|
|
@ -522,7 +509,7 @@ reparse: |
|
|
|
json_object_set_new_nocheck(val, "client_id", json_integer(passthrough_id)); |
|
|
|
json_object_set_new_nocheck(val, "client_id", json_integer(passthrough_id)); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (ckp->redirector && !client->redirected && strstr(msg, "mining.submit")) |
|
|
|
if (ckp->redirector && !client->redirected && strstr(msg, "mining.submit")) |
|
|
|
parse_redirector_share(client, msg, val); |
|
|
|
parse_redirector_share(client, val); |
|
|
|
json_object_set_new_nocheck(val, "client_id", json_integer(client->id)); |
|
|
|
json_object_set_new_nocheck(val, "client_id", json_integer(client->id)); |
|
|
|
json_object_set_new_nocheck(val, "address", json_string(client->address_name)); |
|
|
|
json_object_set_new_nocheck(val, "address", json_string(client->address_name)); |
|
|
|
} |
|
|
|
} |
|
|
|