Browse Source

Merge commit '4f13128' into bfgminer-2.10.x

Luke Dashjr 13 years ago
parent
commit
16d0f9ac33
1 changed files with 11 additions and 5 deletions
  1. 11 5
      miner.c

+ 11 - 5
miner.c

@@ -5967,7 +5967,7 @@ tryagain:
 	rpc_req = prepare_rpc_req(work, proto, NULL);
 	work->pool = pool;
 	if (!rpc_req)
-		return false;
+		goto out;
 
 	pool->probed = false;
 	gettimeofday(&tv_getwork, NULL);
@@ -5980,8 +5980,6 @@ tryagain:
 	/* Detect if a http getwork pool has an X-Stratum header at startup,
 	 * and if so, switch to that in preference to getwork if it works */
 	if (pool->stratum_url && want_stratum && (pool->has_stratum || stratum_works(pool))) {
-		curl_easy_cleanup(curl);
-
 		if (!pool->has_stratum) {
 
 		applog(LOG_NOTICE, "Switching pool %d %s to %s", pool->pool_no, pool->rpc_url, pool->stratum_url);
@@ -5996,6 +5994,8 @@ tryagain:
 			json_decref(val);
 
 retry_stratum:
+		curl_easy_cleanup(curl);
+		
 		/* We create the stratum thread for each pool just after
 		 * successful authorisation. Once the auth flag has been set
 		 * we never unset it and the stratum thread is responsible for
@@ -6069,14 +6069,20 @@ badwork:
 			// NOTE: work_decode takes care of lp id
 			pool->lp_url = lp->uri ? absolute_uri(lp->uri, pool->rpc_url) : pool->rpc_url;
 			if (!pool->lp_url)
-				return false;
+			{
+				ret = false;
+				goto out;
+			}
 			pool->lp_proto = PLP_GETBLOCKTEMPLATE;
 		}
 		else
 		if (pool->hdr_path && want_getwork) {
 			pool->lp_url = absolute_uri(pool->hdr_path, pool->rpc_url);
 			if (!pool->lp_url)
-				return false;
+			{
+				ret = false;
+				goto out;
+			}
 			pool->lp_proto = PLP_GETWORK;
 		} else
 			pool->lp_url = NULL;