Browse Source

Merge commit 'cfe6795' into bfgminer

Luke Dashjr 12 years ago
parent
commit
2251fee113
1 changed files with 8 additions and 5 deletions
  1. 8 5
      miner.c

+ 8 - 5
miner.c

@@ -9022,7 +9022,6 @@ static void *watchpool_thread(void __maybe_unused *userdata)
 			 * from startup are still doing their first attempt. */
 			if (unlikely(pool->testing)) {
 				pthread_join(pool->test_thread, NULL);
-				pool->testing = false;
 			}
 
 			/* Test pool is idle once every minute */
@@ -9501,6 +9500,7 @@ static void *test_pool_thread(void *arg)
 	} else
 		pool_died(pool);
 
+	pool->testing = false;
 	return NULL;
 }
 
@@ -9527,7 +9527,6 @@ bool add_pool_details(struct pool *pool, bool live, char *url, char *user, char
 	pthread_create(&pool->test_thread, NULL, test_pool_thread, (void *)pool);
 	if (!live) {
 		pthread_join(pool->test_thread, NULL);
-		pool->testing = false;
 		return pools_active;
 	}
 	return true;
@@ -10592,14 +10591,18 @@ int main(int argc, char *argv[])
 
 	applog(LOG_NOTICE, "Probing for an alive pool");
 	do {
-		int slept = 0;
+		bool still_testing;
+		int i;
 
 		/* Look for at least one active pool before starting */
 		probe_pools();
 		do {
 			sleep(1);
-			slept++;
-		} while (!pools_active && slept < 60);
+			still_testing = false;
+			for (int i = 0; i < total_pools; ++i)
+				if (pools[i]->testing)
+					still_testing = true;
+		} while (still_testing);
 
 		if (!pools_active) {
 			applog(LOG_ERR, "No servers were found that could be used to get work from.");