From 03abb704673d97d365dcd2df086ff24931ba0daf Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 27 Apr 2012 13:59:43 +1000 Subject: [PATCH] Use longpolls from backup pools with failover-only enabled just to check for block changes, but don't use them as work. --- cgminer.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cgminer.c b/cgminer.c index 0e6be110..e78fe708 100644 --- a/cgminer.c +++ b/cgminer.c @@ -3798,10 +3798,6 @@ static void convert_to_work(json_t *val, bool rolltime, struct pool *pool) struct work *work, *work_clone; bool rc; - /* Don't use as work if we have failover-only enabled */ - if (pool != cp && opt_fail_only) - return; - work = make_work(); rc = work_decode(json_object_get(val, "result"), work); @@ -3814,7 +3810,7 @@ static void convert_to_work(json_t *val, bool rolltime, struct pool *pool) work->rolltime = rolltime; /* Only flag this as longpoll work if the pool is the current pool */ - if (pool == cp) + if (pool == current_pool()) work->longpoll = true; /* We'll be checking this work item twice, but we already know it's @@ -3823,6 +3819,12 @@ static void convert_to_work(json_t *val, bool rolltime, struct pool *pool) * allows testwork to know whether LP discovered the block or not. */ test_work_current(work); + /* Don't use as work if we have failover-only enabled */ + if (!work->longpoll && opt_fail_only) { + free_work(work); + return; + } + work_clone = make_work(); memcpy(work_clone, work, sizeof(struct work)); while (reuse_work(work)) {