Avoid fetching too much work when LP is off

This commit is contained in:
pooler 2014-05-05 13:08:18 +02:00
parent a9e64f41e7
commit 106d03882e

View file

@ -1024,10 +1024,11 @@ static void *miner_thread(void *userdata)
if (work.data[19] >= end_nonce && !memcmp(work.data, g_work.data, 76))
stratum_gen_work(&stratum, &g_work);
} else {
int min_scantime = have_longpoll ? LP_SCANTIME : opt_scantime;
/* obtain new work from internal workio thread */
pthread_mutex_lock(&g_work_lock);
if (!have_stratum && (!have_longpoll ||
time(NULL) >= g_work_time + LP_SCANTIME*3/4 ||
if (!have_stratum &&
(time(NULL) - g_work_time >= min_scantime ||
work.data[19] >= end_nonce)) {
if (unlikely(!get_work(mythr, &g_work))) {
applog(LOG_ERR, "work retrieval failed, exiting "