|
|
@ -4192,6 +4192,9 @@ static bool pool_active(struct pool *pool, bool pinging) |
|
|
|
CURL *curl; |
|
|
|
CURL *curl; |
|
|
|
int rolltime; |
|
|
|
int rolltime; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
applog(LOG_INFO, "Testing pool %s", pool->rpc_url); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
retry_stratum: |
|
|
|
if (pool->has_stratum) { |
|
|
|
if (pool->has_stratum) { |
|
|
|
if ((!pool->stratum_active || pinging) && !initiate_stratum(pool)) |
|
|
|
if ((!pool->stratum_active || pinging) && !initiate_stratum(pool)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
@ -4212,12 +4215,25 @@ static bool pool_active(struct pool *pool, bool pinging) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
applog(LOG_INFO, "Testing pool %s", pool->rpc_url); |
|
|
|
|
|
|
|
gettimeofday(&tv_getwork, NULL); |
|
|
|
gettimeofday(&tv_getwork, NULL); |
|
|
|
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, rpc_req, |
|
|
|
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, rpc_req, |
|
|
|
true, false, &rolltime, pool, false); |
|
|
|
true, false, &rolltime, pool, false); |
|
|
|
gettimeofday(&tv_getwork_reply, NULL); |
|
|
|
gettimeofday(&tv_getwork_reply, NULL); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Detect if a http getwork pool has an X-Stratum header at startup,
|
|
|
|
|
|
|
|
* and if so, switch to that in preference to getwork */ |
|
|
|
|
|
|
|
if (unlikely(!pinging && pool->stratum_url)) { |
|
|
|
|
|
|
|
applog(LOG_NOTICE, "Switching pool %d %s to %s", pool->pool_no, pool->rpc_url, pool->stratum_url); |
|
|
|
|
|
|
|
pool->has_stratum = true; |
|
|
|
|
|
|
|
pool->rpc_url = strdup(pool->stratum_url); |
|
|
|
|
|
|
|
extract_sockaddr(pool, pool->stratum_url); |
|
|
|
|
|
|
|
initiate_stratum(pool); |
|
|
|
|
|
|
|
auth_stratum(pool); |
|
|
|
|
|
|
|
curl_easy_cleanup(curl); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
goto retry_stratum; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (val) { |
|
|
|
if (val) { |
|
|
|
struct work *work = make_work(); |
|
|
|
struct work *work = make_work(); |
|
|
|
bool rc; |
|
|
|
bool rc; |
|
|
|