1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-02-02 10:04:33 +00:00

Flag the pool that is the longpoll thread to avoid sending multiple longpolls during the slight delays between requesting and setting the lp_sent flag.

This commit is contained in:
Con Kolivas 2012-02-19 23:13:02 +11:00
parent a3103d9d5a
commit 3cdac04f4f
2 changed files with 5 additions and 1 deletions

View File

@ -1592,7 +1592,7 @@ static bool get_upstream_work(struct work *work, bool lagging)
/* If this is the current pool and supports longpoll but has not sent /* If this is the current pool and supports longpoll but has not sent
* a longpoll, send one now */ * a longpoll, send one now */
if (unlikely(pool == current_pool() && pool->hdr_path && !pool->lp_sent)) { if (unlikely(pool == current_pool() && !pool->is_lp && pool->hdr_path && !pool->lp_sent)) {
req_longpoll = true; req_longpoll = true;
url = pool->lp_url; url = pool->lp_url;
} }
@ -3566,6 +3566,7 @@ static void *longpoll_thread(void *userdata)
} }
} }
pool->is_lp = true;
have_longpoll = true; have_longpoll = true;
applog(LOG_WARNING, "Long-polling activated for %s", pool->lp_url); applog(LOG_WARNING, "Long-polling activated for %s", pool->lp_url);
@ -3610,7 +3611,9 @@ static void *longpoll_thread(void *userdata)
} }
sp = select_longpoll_pool(); sp = select_longpoll_pool();
if (sp != pool) { if (sp != pool) {
pool->is_lp = false;
pool = sp; pool = sp;
pool->is_lp = true;
applog(LOG_WARNING, "Long-polling changed to %s", pool->lp_url); applog(LOG_WARNING, "Long-polling changed to %s", pool->lp_url);
} }
} }

View File

@ -538,6 +538,7 @@ struct pool {
char *hdr_path; char *hdr_path;
char *lp_url; char *lp_url;
bool lp_sent; bool lp_sent;
bool is_lp;
unsigned int getwork_requested; unsigned int getwork_requested;
unsigned int stale_shares; unsigned int stale_shares;