Browse Source

Get the current pool priority under lock to avoid dereferencing.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
e1c7235227
  1. 12
      main.c

12
main.c

@ -3508,10 +3508,20 @@ static void pool_died(struct pool *pool) @@ -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)
{
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);
}

Loading…
Cancel
Save