|
|
@@ -5475,6 +5475,22 @@ static void clear_stratum_shares(struct pool *pool)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+static void clear_pool_work(struct pool *pool)
|
|
|
+{
|
|
|
+ struct work *work, *tmp;
|
|
|
+ int cleared = 0;
|
|
|
+
|
|
|
+ mutex_lock(stgd_lock);
|
|
|
+ HASH_ITER(hh, staged_work, work, tmp) {
|
|
|
+ if (work->pool == pool) {
|
|
|
+ HASH_DEL(staged_work, work);
|
|
|
+ free_work(work);
|
|
|
+ cleared++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mutex_unlock(stgd_lock);
|
|
|
+}
|
|
|
+
|
|
|
/* We only need to maintain a secondary pool connection when we need the
|
|
|
* capacity to get work from the backup pools while still on the primary */
|
|
|
static bool cnx_needed(struct pool *pool)
|
|
|
@@ -5538,6 +5554,9 @@ static void *stratum_thread(void *userdata)
|
|
|
* pool */
|
|
|
if (!cnx_needed(pool)) {
|
|
|
suspend_stratum(pool);
|
|
|
+ clear_stratum_shares(pool);
|
|
|
+ clear_pool_work(pool);
|
|
|
+
|
|
|
wait_lpcurrent(pool);
|
|
|
if (!initiate_stratum(pool) || !auth_stratum(pool)) {
|
|
|
pool_died(pool);
|
|
|
@@ -5578,6 +5597,9 @@ static void *stratum_thread(void *userdata)
|
|
|
* tracked submitted shares are lost and we will leak
|
|
|
* the memory if we don't discard their records. */
|
|
|
clear_stratum_shares(pool);
|
|
|
+ clear_pool_work(pool);
|
|
|
+ if (pool == current_pool())
|
|
|
+ restart_threads();
|
|
|
|
|
|
if (initiate_stratum(pool) && auth_stratum(pool))
|
|
|
continue;
|
|
|
@@ -7822,7 +7844,7 @@ int main(int argc, char *argv[])
|
|
|
applog(LOG_ERR, "Press any key to exit, or BFGMiner will try again in 15s.");
|
|
|
if (getch() != ERR)
|
|
|
quit(0, "No servers could be used! Exiting.");
|
|
|
- nocbreak();
|
|
|
+ cbreak();
|
|
|
} else
|
|
|
#endif
|
|
|
quit(0, "No servers could be used! Exiting.");
|
|
|
@@ -8015,7 +8037,6 @@ begin_bench:
|
|
|
total_go++;
|
|
|
}
|
|
|
pool = select_pool(lagging);
|
|
|
- lagging = false;
|
|
|
retry:
|
|
|
if (pool->has_stratum) {
|
|
|
while (!pool->stratum_active) {
|