Browse Source

Extend stratum connections another minute (total 2 minutes) after the last work item was staged, and maintain last_work_time for non-stratum pools.

Cherry-picked from: b4cac54a7e7541206a89c7aa128793c82437e344

Conflicts:
	miner.c
Con Kolivas 13 years ago
parent
commit
adcf85ac1e
2 changed files with 5 additions and 5 deletions
  1. 4 4
      miner.c
  2. 1 1
      miner.h

+ 4 - 4
miner.c

@@ -4750,6 +4750,7 @@ static void stage_work(struct work *work)
 {
 {
 	applog(LOG_DEBUG, "Pushing work from pool %d to hash queue", work->pool->pool_no);
 	applog(LOG_DEBUG, "Pushing work from pool %d to hash queue", work->pool->pool_no);
 	work->work_restart_id = work->pool->work_restart_id;
 	work->work_restart_id = work->pool->work_restart_id;
+	work->pool->last_work_time = time(NULL);
 	test_work_current(work);
 	test_work_current(work);
 	hash_push(work);
 	hash_push(work);
 }
 }
@@ -6042,9 +6043,9 @@ static bool cnx_needed(struct pool *pool)
 	if (!cp->has_stratum && (!opt_fail_only || !cp->hdr_path))
 	if (!cp->has_stratum && (!opt_fail_only || !cp->hdr_path))
 		return true;
 		return true;
 
 
-	/* Keep stratum pools alive until at least a minute after their last
-	 * generated work, to ensure we have a channel for any submissions */
-	if (pool->has_stratum && difftime(time(NULL), pool->last_work_time) < 60)
+	/* Keep the connection open to allow any stray shares to be submitted
+	 * on switching pools for 2 minutes. */
+	if (difftime(time(NULL), pool->last_work_time) < 120)
 		return true;
 		return true;
 
 
 	return false;
 	return false;
@@ -8575,7 +8576,6 @@ retry:
 				pool = altpool;
 				pool = altpool;
 				goto retry;
 				goto retry;
 			}
 			}
-			pool->last_work_time = time(NULL);
 			gen_stratum_work(pool, work);
 			gen_stratum_work(pool, work);
 			applog(LOG_DEBUG, "Generated stratum work");
 			applog(LOG_DEBUG, "Generated stratum work");
 			stage_work(work);
 			stage_work(work);

+ 1 - 1
miner.h

@@ -1031,6 +1031,7 @@ struct pool {
 	struct list_head curlring;
 	struct list_head curlring;
 	struct submit_work_state *sws_waiting_on_curl;
 	struct submit_work_state *sws_waiting_on_curl;
 
 
+	time_t last_work_time;
 	time_t last_share_time;
 	time_t last_share_time;
 	double last_share_diff;
 	double last_share_diff;
 	uint64_t best_diff;
 	uint64_t best_diff;
@@ -1053,7 +1054,6 @@ struct pool {
 	char *sessionid;
 	char *sessionid;
 	bool has_stratum;
 	bool has_stratum;
 	bool stratum_active;
 	bool stratum_active;
-	time_t last_work_time;  /* only set for Stratum right now */
 	bool stratum_auth;
 	bool stratum_auth;
 	bool stratum_notify;
 	bool stratum_notify;
 	struct stratum_work swork;
 	struct stratum_work swork;