From fe4b5e1fc63a61d50ebfd3ed7584041e33cb4fde Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 20 Feb 2012 08:24:41 +1100 Subject: [PATCH] Set the lp_sent bool earlier to minimise the number of extra longpolls sent out. --- cgminer.c | 1 + util.c | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cgminer.c b/cgminer.c index 8264db54..d7dfb475 100644 --- a/cgminer.c +++ b/cgminer.c @@ -1593,6 +1593,7 @@ static bool get_upstream_work(struct work *work, bool lagging) /* If this is the current pool and supports longpoll but has not sent * a longpoll, send one now */ if (unlikely(pool == current_pool() && !pool->is_lp && pool->hdr_path && !pool->lp_sent)) { + pool->lp_sent = true; req_longpoll = true; url = pool->lp_url; } diff --git a/util.c b/util.c index a28c0e1e..594ba871 100644 --- a/util.c +++ b/util.c @@ -301,12 +301,10 @@ json_t *json_rpc_call(CURL *curl, const char *url, curl_easy_setopt(curl, CURLOPT_USERPWD, userpass); curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); } - if (longpoll) { - pool->lp_sent = true; #ifdef CURL_HAS_SOCKOPT + if (longpoll) curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, json_rpc_call_sockopt_cb); #endif - } curl_easy_setopt(curl, CURLOPT_POST, 1); if (opt_protocol)