|
@@ -3318,14 +3318,14 @@ static void wake_gws(void)
|
|
|
mutex_unlock(stgd_lock);
|
|
mutex_unlock(stgd_lock);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static void discard_stale(void)
|
|
|
|
|
|
|
+static void discard_stale(bool all)
|
|
|
{
|
|
{
|
|
|
struct work *work, *tmp;
|
|
struct work *work, *tmp;
|
|
|
int stale = 0;
|
|
int stale = 0;
|
|
|
|
|
|
|
|
mutex_lock(stgd_lock);
|
|
mutex_lock(stgd_lock);
|
|
|
HASH_ITER(hh, staged_work, work, tmp) {
|
|
HASH_ITER(hh, staged_work, work, tmp) {
|
|
|
- if (stale_work(work, false)) {
|
|
|
|
|
|
|
+ if (all || stale_work(work, false)) {
|
|
|
HASH_DEL(staged_work, work);
|
|
HASH_DEL(staged_work, work);
|
|
|
discard_work(work);
|
|
discard_work(work);
|
|
|
stale++;
|
|
stale++;
|
|
@@ -3363,7 +3363,7 @@ int restart_wait(unsigned int mstime)
|
|
|
return rc;
|
|
return rc;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static void restart_threads(void)
|
|
|
|
|
|
|
+static void restart_threads(bool all)
|
|
|
{
|
|
{
|
|
|
struct pool *cp = current_pool();
|
|
struct pool *cp = current_pool();
|
|
|
int i;
|
|
int i;
|
|
@@ -3373,7 +3373,7 @@ static void restart_threads(void)
|
|
|
pool_tset(cp, &cp->lagging);
|
|
pool_tset(cp, &cp->lagging);
|
|
|
|
|
|
|
|
/* Discard staged work that is now stale */
|
|
/* Discard staged work that is now stale */
|
|
|
- discard_stale();
|
|
|
|
|
|
|
+ discard_stale(all);
|
|
|
|
|
|
|
|
for (i = 0; i < mining_threads; i++)
|
|
for (i = 0; i < mining_threads; i++)
|
|
|
thr_info[i].work_restart = true;
|
|
thr_info[i].work_restart = true;
|
|
@@ -3497,13 +3497,13 @@ static bool test_work_current(struct work *work)
|
|
|
else
|
|
else
|
|
|
applog(LOG_NOTICE, "New block detected on network");
|
|
applog(LOG_NOTICE, "New block detected on network");
|
|
|
}
|
|
}
|
|
|
- restart_threads();
|
|
|
|
|
|
|
+ restart_threads(false);
|
|
|
} else if (work->longpoll) {
|
|
} else if (work->longpoll) {
|
|
|
work->work_block = ++work_block;
|
|
work->work_block = ++work_block;
|
|
|
if (work->pool == current_pool()) {
|
|
if (work->pool == current_pool()) {
|
|
|
applog(LOG_NOTICE, "%sLONGPOLL from pool %d requested work restart",
|
|
applog(LOG_NOTICE, "%sLONGPOLL from pool %d requested work restart",
|
|
|
work->gbt ? "GBT " : "", work->pool->pool_no);
|
|
work->gbt ? "GBT " : "", work->pool->pool_no);
|
|
|
- restart_threads();
|
|
|
|
|
|
|
+ restart_threads(true);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
work->longpoll = false;
|
|
work->longpoll = false;
|
|
@@ -4616,7 +4616,7 @@ static void *stratum_thread(void *userdata)
|
|
|
/* Only accept a work restart if this stratum
|
|
/* Only accept a work restart if this stratum
|
|
|
* connection is from the current pool */
|
|
* connection is from the current pool */
|
|
|
if (pool == current_pool()) {
|
|
if (pool == current_pool()) {
|
|
|
- restart_threads();
|
|
|
|
|
|
|
+ restart_threads(true);
|
|
|
applog(LOG_NOTICE, "Stratum from pool %d requested work restart", pool->pool_no);
|
|
applog(LOG_NOTICE, "Stratum from pool %d requested work restart", pool->pool_no);
|
|
|
}
|
|
}
|
|
|
} else
|
|
} else
|
|
@@ -5700,7 +5700,7 @@ static void *watchdog_thread(void __maybe_unused *userdata)
|
|
|
|
|
|
|
|
sleep(interval);
|
|
sleep(interval);
|
|
|
|
|
|
|
|
- discard_stale();
|
|
|
|
|
|
|
+ discard_stale(false);
|
|
|
|
|
|
|
|
hashmeter(-1, &zero_tv, 0);
|
|
hashmeter(-1, &zero_tv, 0);
|
|
|
|
|
|