Browse Source

Merge commit 'a39dc04' into bfgminer

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

+ 10 - 1
miner.c

@@ -8460,7 +8460,7 @@ static bool stratum_works(struct pool *pool)
 
 static bool pool_active(struct pool *pool, bool pinging)
 {
-	struct timeval tv_getwork, tv_getwork_reply;
+	struct timeval tv_now, tv_getwork, tv_getwork_reply;
 	bool ret = false;
 	json_t *val;
 	CURL *curl;
@@ -8469,6 +8469,15 @@ static bool pool_active(struct pool *pool, bool pinging)
 	struct work *work;
 	enum pool_protocol proto;
 
+	if (pool->stratum_init)
+		return pool->stratum_active;
+	
+	timer_set_now(&tv_now);
+	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);
 
 	/* This is the central point we activate stratum when we can */