From 345e72e66eccd9d14d80117193235f4dc6e4890b Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 5 Nov 2012 16:17:04 +1100 Subject: [PATCH] Allow the longpoll thread to start with GBT and only set the longpollid once. --- cgminer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cgminer.c b/cgminer.c index 0025684b..57fff4c7 100644 --- a/cgminer.c +++ b/cgminer.c @@ -1561,9 +1561,9 @@ static bool gbt_decode(struct pool *pool, json_t *res_val) mutex_lock(&pool->gbt_lock); free(pool->coinbasetxn); - free(pool->longpollid); pool->coinbasetxn = strdup(coinbasetxn); - pool->longpollid = strdup(longpollid); + if (!pool->longpollid) + pool->longpollid = strdup(longpollid); hex2bin(hash_swap, previousblockhash, 32); swap256(pool->previousblockhash, hash_swap); @@ -4822,7 +4822,7 @@ retry_stratum: } json_decref(val); - if (pool->lp_url || pool->has_gbt) + if (pool->lp_url) goto out; /* Decipher the longpoll URL, if any, and store it in ->lp_url */ @@ -6797,6 +6797,7 @@ int main(int argc, char *argv[]) for (i = 0; i < total_pools; i++) { struct pool *pool = pools[i]; if (pool_active(pool, false)) { + pool_tclear(pool, &pool->idle); if (!currentpool) currentpool = pool; applog(LOG_INFO, "Pool %d %s active", pool->pool_no, pool->rpc_url);