Browse Source

Merge branch 'non-scrypt' into bfgminer

Luke Dashjr 13 years ago
parent
commit
5eea3f213f
1 changed files with 5 additions and 2 deletions
  1. 5 2
      miner.c

+ 5 - 2
miner.c

@@ -2294,16 +2294,19 @@ static void recruit_curl(struct pool *pool)
 
 
 /* Grab an available curl if there is one. If not, then recruit extra curls
 /* Grab an available curl if there is one. If not, then recruit extra curls
  * unless we are in a submit_fail situation, or we have opt_delaynet enabled
  * unless we are in a submit_fail situation, or we have opt_delaynet enabled
- * and there are already 5 curls in circulation */
+ * and there are already 5 curls in circulation. Limit total number to the
+ * number of mining threads per pool as well to prevent blasting a pool during
+ * network delays/outages. */
 static struct curl_ent *pop_curl_entry(struct pool *pool)
 static struct curl_ent *pop_curl_entry(struct pool *pool)
 {
 {
+	int curl_limit = opt_delaynet ? 5 : mining_threads;
 	struct curl_ent *ce;
 	struct curl_ent *ce;
 
 
 	mutex_lock(&pool->pool_lock);
 	mutex_lock(&pool->pool_lock);
 	if (!pool->curls)
 	if (!pool->curls)
 		recruit_curl(pool);
 		recruit_curl(pool);
 	else if (list_empty(&pool->curlring)) {
 	else if (list_empty(&pool->curlring)) {
-		if ((pool->submit_fail || opt_delaynet) && pool->curls > 4)
+		if (pool->curls >= curl_limit)
 			pthread_cond_wait(&pool->cr_cond, &pool->pool_lock);
 			pthread_cond_wait(&pool->cr_cond, &pool->pool_lock);
 		else
 		else
 			recruit_curl(pool);
 			recruit_curl(pool);