mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-02 10:04:33 +00:00
Force fresh curl connections on any detected rpc failure in case of dead persistent connections..
This commit is contained in:
parent
638c8c526f
commit
d56e5ae61b
21
main.c
21
main.c
@ -444,6 +444,16 @@ static bool pool_tclear(struct pool *pool, bool *var)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool pool_isset(struct pool *pool, bool *var)
|
||||||
|
{
|
||||||
|
bool ret;
|
||||||
|
|
||||||
|
mutex_lock(&pool->pool_lock);
|
||||||
|
ret = *var;
|
||||||
|
mutex_unlock(&pool->pool_lock);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static struct pool *current_pool(void)
|
static struct pool *current_pool(void)
|
||||||
{
|
{
|
||||||
struct pool *pool;
|
struct pool *pool;
|
||||||
@ -2292,6 +2302,11 @@ static bool submit_upstream_work(const struct work *work)
|
|||||||
if (opt_debug)
|
if (opt_debug)
|
||||||
applog(LOG_DEBUG, "DBG: sending %s submit RPC call: %s", pool->rpc_url, sd);
|
applog(LOG_DEBUG, "DBG: sending %s submit RPC call: %s", pool->rpc_url, sd);
|
||||||
|
|
||||||
|
/* Force a fresh connection in case there are dead persistent
|
||||||
|
* connections to this pool */
|
||||||
|
if (pool_isset(pool, &pool->submit_fail))
|
||||||
|
curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1);
|
||||||
|
|
||||||
/* issue JSON-RPC request */
|
/* issue JSON-RPC request */
|
||||||
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, s, false, false, &rolltime, pool);
|
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, s, false, false, &rolltime, pool);
|
||||||
if (unlikely(!val)) {
|
if (unlikely(!val)) {
|
||||||
@ -2448,8 +2463,12 @@ retry:
|
|||||||
}
|
}
|
||||||
|
|
||||||
rc = work_decode(json_object_get(val, "result"), work);
|
rc = work_decode(json_object_get(val, "result"), work);
|
||||||
if (!rc && retries < 3)
|
if (!rc && retries < 3) {
|
||||||
|
/* Force a fresh connection in case there are dead persistent
|
||||||
|
* connections */
|
||||||
|
curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1);
|
||||||
goto retry;
|
goto retry;
|
||||||
|
}
|
||||||
work->pool = pool;
|
work->pool = pool;
|
||||||
total_getworks++;
|
total_getworks++;
|
||||||
pool->getwork_requested++;
|
pool->getwork_requested++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user