Browse Source

Bugfix: Remove sws from write_sws list when discarding it due to pre-send stratum disconnection

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

+ 3 - 1
miner.c

@@ -3738,19 +3738,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);