Browse Source

Merge commit 'c7bcad6' into bfgminer

Conflicts:
	miner.c
Luke Dashjr 13 years ago
parent
commit
7ed0f9b030
1 changed files with 9 additions and 5 deletions
  1. 9 5
      miner.c

+ 9 - 5
miner.c

@@ -2351,13 +2351,14 @@ static struct curl_ent *pop_curl_entry(struct pool *pool)
 	struct curl_ent *ce;
 	struct curl_ent *ce;
 
 
 	mutex_lock(&pool->pool_lock);
 	mutex_lock(&pool->pool_lock);
+retry:
 	if (!pool->curls)
 	if (!pool->curls)
 		recruit_curl(pool);
 		recruit_curl(pool);
-	else
-	while (list_empty(&pool->curlring)) {
-		if (pool->submit_fail || pool->curls >= curl_limit)
+	else if (list_empty(&pool->curlring)) {
+		if (pool->submit_fail || pool->curls >= curl_limit) {
 			pthread_cond_wait(&pool->cr_cond, &pool->pool_lock);
 			pthread_cond_wait(&pool->cr_cond, &pool->pool_lock);
-		else
+			goto retry;
+		} else
 			recruit_curl(pool);
 			recruit_curl(pool);
 	}
 	}
 	ce = list_entry(pool->curlring.next, struct curl_ent, node);
 	ce = list_entry(pool->curlring.next, struct curl_ent, node);
@@ -4853,12 +4854,13 @@ static void reap_curl(struct pool *pool)
 {
 {
 	struct curl_ent *ent, *iter;
 	struct curl_ent *ent, *iter;
 	struct timeval now;
 	struct timeval now;
+	int reaped = 0;
 
 
 	gettimeofday(&now, NULL);
 	gettimeofday(&now, NULL);
 	mutex_lock(&pool->pool_lock);
 	mutex_lock(&pool->pool_lock);
 	list_for_each_entry_safe(ent, iter, &pool->curlring, node) {
 	list_for_each_entry_safe(ent, iter, &pool->curlring, node) {
 		if (now.tv_sec - ent->tv.tv_sec > 60) {
 		if (now.tv_sec - ent->tv.tv_sec > 60) {
-			applog(LOG_DEBUG, "Reaped curl %d from pool %d", pool->curls, pool->pool_no);
+			reaped++;
 			pool->curls--;
 			pool->curls--;
 			list_del(&ent->node);
 			list_del(&ent->node);
 			curl_easy_cleanup(ent->curl);
 			curl_easy_cleanup(ent->curl);
@@ -4866,6 +4868,8 @@ static void reap_curl(struct pool *pool)
 		}
 		}
 	}
 	}
 	mutex_unlock(&pool->pool_lock);
 	mutex_unlock(&pool->pool_lock);
+	if (reaped)
+		applog(LOG_DEBUG, "Reaped %d curl%s from pool %d", reaped, reaped > 1 ? "s" : "", pool->pool_no);
 }
 }
 
 
 static void *watchpool_thread(void __maybe_unused *userdata)
 static void *watchpool_thread(void __maybe_unused *userdata)