|
|
@ -766,7 +766,7 @@ out: |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* cs semaphore must be held */ |
|
|
|
/* cs semaphore must be held */ |
|
|
|
static bool passthrough_stratum(connsock_t *cs, proxy_instance_t *proxi) |
|
|
|
static bool passthrough_stratum(ckpool_t *ckp, connsock_t *cs, proxy_instance_t *proxi) |
|
|
|
{ |
|
|
|
{ |
|
|
|
json_t *req, *val = NULL, *res_val, *err_val; |
|
|
|
json_t *req, *val = NULL, *res_val, *err_val; |
|
|
|
bool res, ret = false; |
|
|
|
bool res, ret = false; |
|
|
@ -774,7 +774,7 @@ static bool passthrough_stratum(connsock_t *cs, proxy_instance_t *proxi) |
|
|
|
|
|
|
|
|
|
|
|
JSON_CPACK(req, "{ss,sb,s[s]}", |
|
|
|
JSON_CPACK(req, "{ss,sb,s[s]}", |
|
|
|
"method", "mining.passthrough", |
|
|
|
"method", "mining.passthrough", |
|
|
|
"gz", json_true(), |
|
|
|
"gz", ckp->compress, |
|
|
|
"params", PACKAGE"/"VERSION); |
|
|
|
"params", PACKAGE"/"VERSION); |
|
|
|
res = send_json_msg(cs, req); |
|
|
|
res = send_json_msg(cs, req); |
|
|
|
json_decref(req); |
|
|
|
json_decref(req); |
|
|
@ -812,7 +812,7 @@ out: |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* cs semaphore must be held */ |
|
|
|
/* cs semaphore must be held */ |
|
|
|
static bool node_stratum(connsock_t *cs, proxy_instance_t *proxi) |
|
|
|
static bool node_stratum(ckpool_t *ckp, connsock_t *cs, proxy_instance_t *proxi) |
|
|
|
{ |
|
|
|
{ |
|
|
|
json_t *req, *val = NULL, *res_val, *err_val; |
|
|
|
json_t *req, *val = NULL, *res_val, *err_val; |
|
|
|
bool res, ret = false; |
|
|
|
bool res, ret = false; |
|
|
@ -820,7 +820,7 @@ static bool node_stratum(connsock_t *cs, proxy_instance_t *proxi) |
|
|
|
|
|
|
|
|
|
|
|
JSON_CPACK(req, "{ss,sb,s[s]}", |
|
|
|
JSON_CPACK(req, "{ss,sb,s[s]}", |
|
|
|
"method", "mining.node", |
|
|
|
"method", "mining.node", |
|
|
|
"gz", json_true(), |
|
|
|
"gz", ckp->compress, |
|
|
|
"params", PACKAGE"/"VERSION); |
|
|
|
"params", PACKAGE"/"VERSION); |
|
|
|
|
|
|
|
|
|
|
|
res = send_json_msg(cs, req); |
|
|
|
res = send_json_msg(cs, req); |
|
|
@ -1855,7 +1855,7 @@ static bool proxy_alive(ckpool_t *ckp, proxy_instance_t *proxi, connsock_t *cs, |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
if (ckp->node) { |
|
|
|
if (ckp->node) { |
|
|
|
if (!node_stratum(cs, proxi)) { |
|
|
|
if (!node_stratum(ckp, cs, proxi)) { |
|
|
|
LOGWARNING("Failed initial node setup to %s:%s !", |
|
|
|
LOGWARNING("Failed initial node setup to %s:%s !", |
|
|
|
cs->url, cs->port); |
|
|
|
cs->url, cs->port); |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
@ -1864,7 +1864,7 @@ static bool proxy_alive(ckpool_t *ckp, proxy_instance_t *proxi, connsock_t *cs, |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
if (ckp->passthrough) { |
|
|
|
if (ckp->passthrough) { |
|
|
|
if (!passthrough_stratum(cs, proxi)) { |
|
|
|
if (!passthrough_stratum(ckp, cs, proxi)) { |
|
|
|
LOGWARNING("Failed initial passthrough to %s:%s !", |
|
|
|
LOGWARNING("Failed initial passthrough to %s:%s !", |
|
|
|
cs->url, cs->port); |
|
|
|
cs->url, cs->port); |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|