Browse Source

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

Conflicts:
	util.c

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

+ 2 - 1
util.c

@@ -1638,7 +1638,6 @@ bool initiate_stratum(struct pool *pool)
 	}
 	if (pool->sockbuf)
 		pool->sockbuf[0] = '\0';
-	mutex_unlock(&pool->stratum_lock);
 	curl = pool->stratum_curl;
 
 	if (!pool->sockbuf) {
@@ -1694,6 +1693,8 @@ bool initiate_stratum(struct pool *pool)
 	pool->cgminer_pool_stats.times_sent++;
 	pool->cgminer_pool_stats.times_received++;
 
+	mutex_unlock(&pool->stratum_lock);
+	
 	sprintf(s, "{\"id\": %d, \"method\": \"mining.subscribe\", \"params\": []}", swork_id++);
 
 	if (__stratum_send(pool, s, strlen(s)) != SEND_OK) {