|
|
@ -1556,6 +1556,12 @@ static void *proxy_send(void *arg) |
|
|
|
proxyid); |
|
|
|
proxyid); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
subproxy = subproxy_by_id(proxy, subid); |
|
|
|
|
|
|
|
if (unlikely(!subproxy)) { |
|
|
|
|
|
|
|
LOGWARNING("Proxysend for got message for non-existent subproxy %d:%d", |
|
|
|
|
|
|
|
proxyid, subid); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
mutex_lock(&proxy->notify_lock); |
|
|
|
mutex_lock(&proxy->notify_lock); |
|
|
|
HASH_FIND_INT(proxy->notify_instances, &id, ni); |
|
|
|
HASH_FIND_INT(proxy->notify_instances, &id, ni); |
|
|
@ -1563,27 +1569,22 @@ static void *proxy_send(void *arg) |
|
|
|
jobid = json_copy(ni->jobid); |
|
|
|
jobid = json_copy(ni->jobid); |
|
|
|
mutex_unlock(&proxy->notify_lock); |
|
|
|
mutex_unlock(&proxy->notify_lock); |
|
|
|
|
|
|
|
|
|
|
|
subproxy = subproxy_by_id(proxy, subid); |
|
|
|
if (unlikely(!jobid)) { |
|
|
|
if (unlikely(!subproxy)) { |
|
|
|
|
|
|
|
LOGWARNING("Proxysend for got message for non-existent subproxy %d:%d", |
|
|
|
|
|
|
|
proxyid, subid); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cs = &subproxy->cs; |
|
|
|
|
|
|
|
if (jobid) { |
|
|
|
|
|
|
|
JSON_CPACK(val, "{s[soooo]soss}", "params", proxy->auth, jobid, |
|
|
|
|
|
|
|
json_object_dup(msg->json_msg, "nonce2"), |
|
|
|
|
|
|
|
json_object_dup(msg->json_msg, "ntime"), |
|
|
|
|
|
|
|
json_object_dup(msg->json_msg, "nonce"), |
|
|
|
|
|
|
|
"id", json_object_dup(msg->json_msg, "id"), |
|
|
|
|
|
|
|
"method", "mining.submit"); |
|
|
|
|
|
|
|
ret = send_json_msg(cs, val); |
|
|
|
|
|
|
|
json_decref(val); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
stratifier_reconnect_client(ckp, client_id); |
|
|
|
stratifier_reconnect_client(ckp, client_id); |
|
|
|
LOGNOTICE("Proxy %d:%s failed to find matching jobid in proxysend", |
|
|
|
LOGNOTICE("Proxy %d:%s failed to find matching jobid in proxysend", |
|
|
|
proxy->id, proxy->url); |
|
|
|
proxy->id, proxy->url); |
|
|
|
|
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cs = &subproxy->cs; |
|
|
|
|
|
|
|
JSON_CPACK(val, "{s[soooo]soss}", "params", proxy->auth, jobid, |
|
|
|
|
|
|
|
json_object_dup(msg->json_msg, "nonce2"), |
|
|
|
|
|
|
|
json_object_dup(msg->json_msg, "ntime"), |
|
|
|
|
|
|
|
json_object_dup(msg->json_msg, "nonce"), |
|
|
|
|
|
|
|
"id", json_object_dup(msg->json_msg, "id"), |
|
|
|
|
|
|
|
"method", "mining.submit"); |
|
|
|
|
|
|
|
ret = send_json_msg(cs, val); |
|
|
|
|
|
|
|
json_decref(val); |
|
|
|
if (!ret) { |
|
|
|
if (!ret) { |
|
|
|
LOGNOTICE("Proxy %d:%d %s failed to send msg in proxy_send, dropping to reconnect", |
|
|
|
LOGNOTICE("Proxy %d:%d %s failed to send msg in proxy_send, dropping to reconnect", |
|
|
|
proxy->id, subid, proxy->url); |
|
|
|
proxy->id, subid, proxy->url); |
|
|
|