mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-23 04:54:26 +00:00
Revert "Rollback breakage to 81567e515707891837f52bc3aac7d5916dfff5a2"
This reverts commit a8863995dee7bcd089e1aa9a3b86cd5c749d0d65. This should work now...
This commit is contained in:
parent
8630525c5d
commit
de28944328
37
cgminer.c
37
cgminer.c
@ -2618,11 +2618,23 @@ static struct pool *select_balanced(struct pool *cp)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/* Select any active pool in a rotating fashion when loadbalance is chosen */
|
/* Select any active pool in a rotating fashion when loadbalance is chosen */
|
||||||
static inline struct pool *select_pool(bool lagging)
|
static inline struct pool *select_pool(bool lagging)
|
||||||
{
|
{
|
||||||
static int rotating_pool = 0;
|
static int rotating_pool = 0;
|
||||||
struct pool *pool, *cp;
|
struct pool *pool, *cp;
|
||||||
|
int tested;
|
||||||
|
|
||||||
cp = current_pool();
|
cp = current_pool();
|
||||||
|
|
||||||
@ -2634,14 +2646,19 @@ static inline struct pool *select_pool(bool lagging)
|
|||||||
else
|
else
|
||||||
pool = NULL;
|
pool = NULL;
|
||||||
|
|
||||||
while (!pool) {
|
/* Try to find the first pool in the rotation that is usable */
|
||||||
|
tested = 0;
|
||||||
|
while (!pool && tested++ < total_pools) {
|
||||||
if (++rotating_pool >= total_pools)
|
if (++rotating_pool >= total_pools)
|
||||||
rotating_pool = 0;
|
rotating_pool = 0;
|
||||||
pool = pools[rotating_pool];
|
pool = pools[rotating_pool];
|
||||||
if ((!pool->idle && pool->enabled == POOL_ENABLED) || pool == cp)
|
if (!pool_unusable(pool))
|
||||||
break;
|
break;
|
||||||
pool = NULL;
|
pool = NULL;
|
||||||
}
|
}
|
||||||
|
/* If still nothing is usable, use the current pool */
|
||||||
|
if (!pool)
|
||||||
|
pool = cp;
|
||||||
|
|
||||||
return pool;
|
return pool;
|
||||||
}
|
}
|
||||||
@ -3386,10 +3403,10 @@ 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) && pool != selected)
|
||||||
pool_no = pool->pool_no;
|
continue;
|
||||||
break;
|
pool_no = pool->pool_no;
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/* Both of these simply increment and cycle */
|
/* Both of these simply increment and cycle */
|
||||||
@ -3406,10 +3423,10 @@ 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) && pool != selected)
|
||||||
pool_no = next_pool;
|
continue;
|
||||||
break;
|
pool_no = next_pool;
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user