Browse Source

Merge branch 'bfgminer-2.10.x' into bfgminer

Luke Dashjr 13 years ago
parent
commit
17af46a48e
1 changed files with 18 additions and 3 deletions
  1. 18 3
      miner.c

+ 18 - 3
miner.c

@@ -2934,6 +2934,9 @@ static struct pool *select_balanced(struct pool *cp)
 	return ret;
 }
 
+static bool pool_active(struct pool *, bool pinging);
+static void pool_died(struct pool *);
+
 /* Select any active pool in a rotating fashion when loadbalance is chosen */
 static inline struct pool *select_pool(bool lagging)
 {
@@ -2942,8 +2945,12 @@ static inline struct pool *select_pool(bool lagging)
 
 	cp = current_pool();
 
+retry:
 	if (pool_strategy == POOL_BALANCE)
-		return select_balanced(cp);
+	{
+		pool = select_balanced(cp);
+		goto have_pool;
+	}
 
 	if (pool_strategy != POOL_LOADBALANCE && (!lagging || opt_fail_only))
 		pool = cp;
@@ -2959,6 +2966,16 @@ static inline struct pool *select_pool(bool lagging)
 		pool = NULL;
 	}
 
+have_pool:
+	if (cp != pool)
+	{
+		if (!pool_active(pool, false))
+		{
+			pool_died(pool);
+			goto retry;
+		}
+		pool_tclear(pool, &pool->idle);
+	}
 	return pool;
 }
 
@@ -5786,8 +5803,6 @@ static void shutdown_stratum(struct pool *pool)
 	pool->stratum_url = NULL;
 }
 
-static bool pool_active(struct pool *pool, bool pinging);
-
 static void clear_stratum_shares(struct pool *pool)
 {
 	struct stratum_share *sshare, *tmpshare;