Commit 61f4e9d6049c2441f5e388faec0dfb0b98d19348

Con Kolivas 2012-11-18T17:22:48

Revert "Discard all work on longpoll, not just work cgminer recognises as stale." This reverts commit 1470eea903266fc5cef8e722859dca55ae460183. Work block update makes this unnecessary.

diff --git a/cgminer.c b/cgminer.c
index 83159b2..6a38c75 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -3415,27 +3415,6 @@ static void discard_stale(void)
 	}
 }
 
-static void discard_all(struct pool *pool)
-{
-	struct work *work, *tmp;
-	int discarded = 0;
-
-	mutex_lock(stgd_lock);
-	HASH_ITER(hh, staged_work, work, tmp) {
-		HASH_DEL(staged_work, work);
-		work->pool->staged--;
-		discard_work(work);
-		discarded++;
-	}
-	mutex_unlock(stgd_lock);
-
-	if (discarded) {
-		applog(LOG_DEBUG, "Discarded %d work items by pool %d request", discarded, pool->pool_no);
-		while (discarded-- > 0)
-			queue_request();
-	}
-}
-
 /* A generic wait function for threads that poll that will wait a specified
  * time tdiff waiting on the pthread conditional that is broadcast when a
  * work restart is required. Returns the value of pthread_cond_timedwait
@@ -3470,8 +3449,8 @@ static void restart_threads(void)
 	 * fast enough  messages after every long poll */
 	pool_tset(cp, &cp->lagging);
 
-	/* Force discard all work even if not stale */
-	discard_all(cp);
+	/* Discard staged work that is now stale */
+	discard_stale();
 
 	for (i = 0; i < mining_threads; i++)
 		thr_info[i].work_restart = true;