Browse Source

Backport pool_actively_in_use from BFGMiner 4.0

Luke Dashjr 12 years ago
parent
commit
d857720d2e
1 changed files with 13 additions and 1 deletions
  1. 13 1
      miner.c

+ 13 - 1
miner.c

@@ -4042,7 +4042,7 @@ out:
 }
 }
 
 
 /* Specifies whether we can use this pool for work or not. */
 /* Specifies whether we can use this pool for work or not. */
-static bool pool_unworkable(struct pool *pool)
+static bool pool_unworkable(const struct pool * const pool)
 {
 {
 	if (pool->idle)
 	if (pool->idle)
 		return true;
 		return true;
@@ -4053,6 +4053,18 @@ static bool pool_unworkable(struct pool *pool)
 	return false;
 	return false;
 }
 }
 
 
+static
+bool pool_actively_in_use(const struct pool * const pool, const struct pool *cp)
+{
+	if (pool_unworkable(pool))
+		return false;
+	if (pool_strategy == POOL_LOADBALANCE || pool_strategy == POOL_BALANCE)
+		return true;
+	if (!cp)
+		cp = current_pool();
+	return (pool == cp);
+}
+
 /* In balanced mode, the amount of diff1 solutions per pool is monitored as a
 /* 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
  * 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
  * away from them to distribute work evenly. The share count is reset to the