Browse Source

Merge commit 'ac55fb0' into bfgminer

Luke Dashjr 13 years ago
parent
commit
53f347cbff
1 changed files with 3 additions and 1 deletions
  1. 3 1
      miner.c

+ 3 - 1
miner.c

@@ -3723,19 +3723,21 @@ static void *submit_work_thread(__maybe_unused void *userdata)
 		} else
 			timeoutp = NULL;
 		
-		for (sws = write_sws; sws; sws = sws->next) {
+		for (swsp = &write_sws; (sws = *swsp); ) {
 			int fd = sws->work->pool->sock;
 			if (fd == INVSOCK) {
 				applog(LOG_WARNING, "Stratum pool %u died while share waiting to submit, discarding", sws->work->pool->pool_no);
 				submit_discard_share2("disconnect", sws->work);
 				--wip;
 				++tsreduce;
+				*swsp = sws->next;
 				free_sws(sws);
 				continue;
 			}
 			FD_SET(fd, &wfds);
 			if (fd > maxfd)
 				maxfd = fd;
+			swsp = &sws->next;
 		}
 		if (tsreduce) {
 			mutex_lock(&submitting_lock);