Browse Source

Merge commit '0803bd2' into bfgminer-2.10.x

Conflicts:
	miner.c
Luke Dashjr 13 years ago
parent
commit
c082486867
1 changed files with 18 additions and 3 deletions
  1. 18 3
      miner.c

+ 18 - 3
miner.c

@@ -2826,6 +2826,9 @@ static struct pool *select_balanced(struct pool *cp)
 	return ret;
 	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 */
 /* 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)
 {
 {
@@ -2834,8 +2837,12 @@ static inline struct pool *select_pool(bool lagging)
 
 
 	cp = current_pool();
 	cp = current_pool();
 
 
+retry:
 	if (pool_strategy == POOL_BALANCE)
 	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))
 	if (pool_strategy != POOL_LOADBALANCE && (!lagging || opt_fail_only))
 		pool = cp;
 		pool = cp;
@@ -2851,6 +2858,16 @@ static inline struct pool *select_pool(bool lagging)
 		pool = NULL;
 		pool = NULL;
 	}
 	}
 
 
+have_pool:
+	if (cp != pool)
+	{
+		if (!pool_active(pool, false))
+		{
+			pool_died(pool);
+			goto retry;
+		}
+		pool_tclear(pool, &pool->idle);
+	}
 	return pool;
 	return pool;
 }
 }
 
 
@@ -5637,8 +5654,6 @@ static void shutdown_stratum(struct pool *pool)
 	pool->stratum_url = NULL;
 	pool->stratum_url = NULL;
 }
 }
 
 
-static bool pool_active(struct pool *pool, bool pinging);
-
 static void clear_stratum_shares(struct pool *pool)
 static void clear_stratum_shares(struct pool *pool)
 {
 {
 	struct stratum_share *sshare, *tmpshare;
 	struct stratum_share *sshare, *tmpshare;