mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-04 19:14:26 +00:00
Test for sequential getwork failures on a pool that might actually be up but failing to deliver work as we may end up hammering it repeatedly by mistake.
This commit is contained in:
parent
77d2a2096c
commit
57a73dce34
24
cgminer.c
24
cgminer.c
@ -2476,6 +2476,15 @@ out:
|
|||||||
|
|
||||||
static bool queue_request(void);
|
static bool queue_request(void);
|
||||||
|
|
||||||
|
static void pool_died(struct pool *pool)
|
||||||
|
{
|
||||||
|
if (!pool_tset(pool, &pool->idle)) {
|
||||||
|
applog(LOG_WARNING, "Pool %d %s not responding!", pool->pool_no, pool->rpc_url);
|
||||||
|
gettimeofday(&pool->tv_idle, NULL);
|
||||||
|
switch_pools(NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void *get_work_thread(void *userdata)
|
static void *get_work_thread(void *userdata)
|
||||||
{
|
{
|
||||||
struct workio_cmd *wc = (struct workio_cmd *)userdata;
|
struct workio_cmd *wc = (struct workio_cmd *)userdata;
|
||||||
@ -2508,13 +2517,17 @@ static void *get_work_thread(void *userdata)
|
|||||||
|
|
||||||
/* obtain new work from bitcoin via JSON-RPC */
|
/* obtain new work from bitcoin via JSON-RPC */
|
||||||
if (!get_upstream_work(ret_work, ce->curl)) {
|
if (!get_upstream_work(ret_work, ce->curl)) {
|
||||||
/* pause, then restart work-request loop */
|
|
||||||
applog(LOG_DEBUG, "json_rpc_call failed on get work, retrying");
|
applog(LOG_DEBUG, "json_rpc_call failed on get work, retrying");
|
||||||
dec_queued(pool);
|
dec_queued(pool);
|
||||||
|
/* Make sure the pool just hasn't stopped serving
|
||||||
|
* requests but is up as we'll keep hammering it */
|
||||||
|
if (++pool->seq_getfails > mining_threads + opt_queue)
|
||||||
|
pool_died(pool);
|
||||||
queue_request();
|
queue_request();
|
||||||
free_work(ret_work);
|
free_work(ret_work);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
pool->seq_getfails = 0;
|
||||||
|
|
||||||
ret_work->queued = true;
|
ret_work->queued = true;
|
||||||
}
|
}
|
||||||
@ -3998,15 +4011,6 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pool_died(struct pool *pool)
|
|
||||||
{
|
|
||||||
if (!pool_tset(pool, &pool->idle)) {
|
|
||||||
applog(LOG_WARNING, "Pool %d %s not responding!", pool->pool_no, pool->rpc_url);
|
|
||||||
gettimeofday(&pool->tv_idle, NULL);
|
|
||||||
switch_pools(NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int cp_prio(void)
|
static inline int cp_prio(void)
|
||||||
{
|
{
|
||||||
int prio;
|
int prio;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user