mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-05 03:24:26 +00:00
Retry before returning a failure to get upstream work as a failure to avoid false positives for pool dead.
This commit is contained in:
parent
36a65e41ea
commit
f10f8faefb
9
main.c
9
main.c
@ -1986,8 +1986,9 @@ static inline struct pool *select_pool(bool lagging)
|
||||
static bool get_upstream_work(struct work *work, bool lagging)
|
||||
{
|
||||
struct pool *pool;
|
||||
json_t *val;
|
||||
json_t *val = NULL;
|
||||
bool rc = false;
|
||||
int retries = 0;
|
||||
CURL *curl;
|
||||
|
||||
curl = curl_easy_init();
|
||||
@ -2000,7 +2001,11 @@ static bool get_upstream_work(struct work *work, bool lagging)
|
||||
if (opt_debug)
|
||||
applog(LOG_DEBUG, "DBG: sending %s get RPC call: %s", pool->rpc_url, rpc_req);
|
||||
|
||||
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, rpc_req,
|
||||
/* A single failure response here might be reported as a dead pool and
|
||||
* there may be temporary denied messages etc. falsely reporting
|
||||
* failure so retry a few times before giving up */
|
||||
while (!val && retries++ < 3)
|
||||
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, rpc_req,
|
||||
false, false, &work->rolltime, pool);
|
||||
if (unlikely(!val)) {
|
||||
applog(LOG_DEBUG, "Failed json_rpc_call in get_upstream_work");
|
||||
|
Loading…
x
Reference in New Issue
Block a user