Browse Source

Bugfix: Avoid lingering stratum_auth when connection is lost

Luke Dashjr 13 years ago
parent
commit
026a9a0b20
2 changed files with 4 additions and 2 deletions
  1. 2 2
      miner.c
  2. 2 0
      util.c

+ 2 - 2
miner.c

@@ -5406,6 +5406,8 @@ out:
 static void shutdown_stratum(struct pool *pool)
 {
 	// Shut down Stratum as if we never had it
+	pool->stratum_active = false;
+	pool->stratum_auth = false;
 	pool->has_stratum = false;
 	shutdown(pool->sock, SHUT_RDWR);
 	free(pool->stratum_url);
@@ -5655,8 +5657,6 @@ retry_stratum:
 			return false;
 		if (!auth_stratum(pool))
 			return false;
-		pool->idle = false;
-		pool->stratum_auth = true;
 		init_stratum_thread(pool);
 		detect_algo = 2;
 		return true;

+ 2 - 0
util.c

@@ -1290,6 +1290,7 @@ bool auth_stratum(struct pool *pool)
 	}
 	ret = true;
 	applog(LOG_INFO, "Stratum authorisation success for pool %d", pool->pool_no);
+	pool->stratum_auth = true;
 out:
 	if (val)
 		json_decref(val);
@@ -1308,6 +1309,7 @@ bool initiate_stratum(struct pool *pool)
 
 	mutex_lock(&pool->stratum_lock);
 	pool->stratum_active = false;
+	pool->stratum_auth = false;
 	if (!pool->stratum_curl) {
 		pool->stratum_curl = curl_easy_init();
 		if (unlikely(!pool->stratum_curl))