From b4cac54a7e7541206a89c7aa128793c82437e344 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Thu, 28 Feb 2013 23:35:31 +1100 Subject: [PATCH] Keep stratum connections open for 2 minutes after the last work item was staged to allow stray shares to be submitted on pool switching. --- cgminer.c | 5 +++++ miner.h | 1 + 2 files changed, 6 insertions(+) diff --git a/cgminer.c b/cgminer.c index 69809889..ee751875 100644 --- a/cgminer.c +++ b/cgminer.c @@ -3663,6 +3663,7 @@ static void stage_work(struct work *work) { applog(LOG_DEBUG, "Pushing work from pool %d to hash queue", work->pool->pool_no); work->work_block = work_block; + work->pool->last_work_time = time(NULL); test_work_current(work); hash_push(work); } @@ -4669,6 +4670,10 @@ static bool cnx_needed(struct pool *pool) return true; if (!cp->has_gbt && !cp->has_stratum && (!opt_fail_only || !cp->hdr_path)) return true; + /* Keep the connection open to allow any stray shares to be submitted + * on switching pools for 2 minutes. */ + if (time(NULL) < pool->last_work_time + 120) + return true; return false; } diff --git a/miner.h b/miner.h index d277aeaa..ca3df47d 100644 --- a/miner.h +++ b/miner.h @@ -924,6 +924,7 @@ struct pool { pthread_cond_t cr_cond; struct list_head curlring; + time_t last_work_time; time_t last_share_time; double last_share_diff;