Browse Source

Bugfix: setup_stratum_curl: Hold stratum lock until connection completes, to avoid potential races

Conflicts:
	util.c
Luke Dashjr 13 years ago
parent
commit
06c7289feb
1 changed files with 2 additions and 1 deletions
  1. 2 1
      util.c

+ 2 - 1
util.c

@@ -1797,7 +1797,6 @@ static bool setup_stratum_curl(struct pool *pool)
 		quit(1, "Failed to curl_easy_init in initiate_stratum");
 		quit(1, "Failed to curl_easy_init in initiate_stratum");
 	if (pool->sockbuf)
 	if (pool->sockbuf)
 		pool->sockbuf[0] = '\0';
 		pool->sockbuf[0] = '\0';
-	mutex_unlock(&pool->stratum_lock);
 	curl = pool->stratum_curl;
 	curl = pool->stratum_curl;
 
 
 	if (!pool->sockbuf) {
 	if (!pool->sockbuf) {
@@ -1854,6 +1853,8 @@ static bool setup_stratum_curl(struct pool *pool)
 	pool->cgminer_pool_stats.times_sent++;
 	pool->cgminer_pool_stats.times_sent++;
 	pool->cgminer_pool_stats.times_received++;
 	pool->cgminer_pool_stats.times_received++;
 
 
+	mutex_unlock(&pool->stratum_lock);
+	
 	return true;
 	return true;
 }
 }