Commit d932a36c463246019322a003f89cf3cca11b26ed

Con Kolivas 2013-03-09T09:34:01

Use pool_unworkable in select_balanced as well.

diff --git a/cgminer.c b/cgminer.c
index fcef695..c98cc31 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -2593,6 +2593,18 @@ out:
 	return rc;
 }
 
+/* Specifies whether we can use this pool for work or not. */
+static bool pool_unworkable(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;
+}
+
 /* In balanced mode, the amount of diff1 solutions per pool is monitored as a
  * rolling average per 10 minutes and if pools start getting more, it biases
  * away from them to distribute work evenly. The share count is reset to the
@@ -2606,7 +2618,7 @@ static struct pool *select_balanced(struct pool *cp)
 	for (i = 0; i < total_pools; i++) {
 		struct pool *pool = pools[i];
 
-		if (pool->idle || pool->enabled != POOL_ENABLED)
+		if (pool_unworkable(pool))
 			continue;
 		if (pool->shares < lowest) {
 			lowest = pool->shares;
@@ -2618,18 +2630,6 @@ static struct pool *select_balanced(struct pool *cp)
 	return ret;
 }
 
-/* Specifies whether we can use this pool for work or not. */
-static bool pool_unworkable(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 */
 static inline struct pool *select_pool(bool lagging)
 {