Browse Source

Merge commit 'a4772ea' into bfgminer-3.10.x

Luke Dashjr 11 years ago
parent
commit
ca0cb1c523
1 changed files with 11 additions and 2 deletions
  1. 11 2
      miner.c

+ 11 - 2
miner.c

@@ -8415,10 +8415,14 @@ static bool pool_active(struct pool *pool, bool pinging)
 		return pool->stratum_active;
 	
 	timer_set_now(&tv_now);
+	if (pool->idle)
+	{
+		if (timer_elapsed(&pool->tv_idle, &tv_now) < 30)
+			return false;
+	}
+	else
 	if (timer_isset(&pool->tv_last_work_time) && timer_elapsed(&pool->tv_last_work_time, &tv_now) < 60)
 		return true;
-	if (pool->idle && timer_elapsed(&pool->tv_idle, &tv_now) < 30)
-		return false;
 	
 		applog(LOG_INFO, "Testing pool %s", pool->rpc_url);
 
@@ -8485,7 +8489,10 @@ retry_stratum:
 				init_stratum_thread(pool);
 			}
 			else
+			{
 				pool_tclear(pool, &pool->stratum_init);
+				pool->tv_idle = tv_getwork_reply;
+			}
 			return ret;
 		}
 		return pool->stratum_active;
@@ -8529,6 +8536,7 @@ badwork:
 			pool->proto = proto = pool_protocol_fallback(proto);
 			if (PLP_NONE != proto)
 				goto tryagain;
+			pool->tv_idle = tv_getwork_reply;
 			free_work(work);
 			goto out;
 		}
@@ -8576,6 +8584,7 @@ badwork:
 		pool->proto = proto;
 		goto tryagain;
 	} else {
+		pool->tv_idle = tv_getwork_reply;
 		free_work(work);
 nohttp:
 		/* If we failed to parse a getwork, this could be a stratum