mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-23 13:04:29 +00:00
Add a pool_unusable function which checks if a pool is stratum but not active to use within switch_pools.
This commit is contained in:
parent
81567e5157
commit
ade8c6c79c
19
cgminer.c
19
cgminer.c
@ -3358,6 +3358,17 @@ static struct pool *priority_pool(int choice)
|
|||||||
|
|
||||||
static void clear_pool_work(struct pool *pool);
|
static void clear_pool_work(struct pool *pool);
|
||||||
|
|
||||||
|
static bool pool_unusable(struct pool *pool)
|
||||||
|
{
|
||||||
|
if (pool->idle)
|
||||||
|
return true;
|
||||||
|
if (pool->enabled != POOL_ENABLED)
|
||||||
|
return true;
|
||||||
|
if (pool->has_stratum && !pool->stratum_active)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void switch_pools(struct pool *selected)
|
void switch_pools(struct pool *selected)
|
||||||
{
|
{
|
||||||
struct pool *pool, *last_pool;
|
struct pool *pool, *last_pool;
|
||||||
@ -3386,11 +3397,11 @@ void switch_pools(struct pool *selected)
|
|||||||
case POOL_LOADBALANCE:
|
case POOL_LOADBALANCE:
|
||||||
for (i = 0; i < total_pools; i++) {
|
for (i = 0; i < total_pools; i++) {
|
||||||
pool = priority_pool(i);
|
pool = priority_pool(i);
|
||||||
if (!pool->idle && pool->enabled == POOL_ENABLED) {
|
if (pool_unusable(pool))
|
||||||
|
continue;
|
||||||
pool_no = pool->pool_no;
|
pool_no = pool->pool_no;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
/* Both of these simply increment and cycle */
|
/* Both of these simply increment and cycle */
|
||||||
case POOL_ROUNDROBIN:
|
case POOL_ROUNDROBIN:
|
||||||
@ -3406,11 +3417,11 @@ void switch_pools(struct pool *selected)
|
|||||||
if (next_pool >= total_pools)
|
if (next_pool >= total_pools)
|
||||||
next_pool = 0;
|
next_pool = 0;
|
||||||
pool = pools[next_pool];
|
pool = pools[next_pool];
|
||||||
if (!pool->idle && pool->enabled == POOL_ENABLED) {
|
if (pool_unusable(pool))
|
||||||
|
continue;
|
||||||
pool_no = next_pool;
|
pool_no = next_pool;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user