1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-11 07:17:58 +00:00

Get the current pool priority under lock to avoid dereferencing.

This commit is contained in:
Con Kolivas 2011-09-14 23:15:42 +10:00
parent 918ec7b0b2
commit e1c7235227

12
main.c
View File

@ -3508,10 +3508,20 @@ static void pool_died(struct pool *pool)
} }
} }
static inline int cp_prio(void)
{
int prio;
mutex_lock(&control_lock);
prio = currentpool->prio;
mutex_unlock(&control_lock);
return prio;
}
static void pool_resus(struct pool *pool) static void pool_resus(struct pool *pool)
{ {
applog(LOG_WARNING, "Pool %d %s recovered", pool->pool_no, pool->rpc_url); applog(LOG_WARNING, "Pool %d %s recovered", pool->pool_no, pool->rpc_url);
if (pool->prio < current_pool()->prio && pool_strategy == POOL_FAILOVER) if (pool->prio < cp_prio() && pool_strategy == POOL_FAILOVER)
switch_pools(NULL); switch_pools(NULL);
} }