Browse Source

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

Luke Dashjr 12 years ago
parent
commit
2575f8be0e
1 changed files with 2 additions and 1 deletions
  1. 2 1
      util.c

+ 2 - 1
util.c

@@ -1979,7 +1979,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;
 
 
@@ -2038,6 +2037,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;
 }
 }