Browse Source

Check stratum socket exists and is writable before even considering whether the sessionid is the same or not

Luke Dashjr 12 years ago
parent
commit
bc6954490d
1 changed files with 7 additions and 7 deletions
  1. 7 7
      miner.c

+ 7 - 7
miner.c

@@ -4219,6 +4219,13 @@ static void *submit_work_thread(__maybe_unused void *userdata)
 			int fd = pool->sock;
 			int fd = pool->sock;
 			bool sessionid_match;
 			bool sessionid_match;
 			
 			
+			if (fd == INVSOCK || (!pool->stratum_init) || (!pool->stratum_notify) || !FD_ISSET(fd, &wfds)) {
+next_write_sws:
+				// TODO: Check if stale, possibly discard etc
+				swsp = &sws->next;
+				continue;
+			}
+			
 			cg_rlock(&pool->data_lock);
 			cg_rlock(&pool->data_lock);
 			// NOTE: cgminer only does this check on retries, but BFGMiner does it for even the first/normal submit; therefore, it needs to be such that it always is true on the same connection regardless of session management
 			// NOTE: cgminer only does this check on retries, but BFGMiner does it for even the first/normal submit; therefore, it needs to be such that it always is true on the same connection regardless of session management
 			// NOTE: Worst case scenario for a false positive: the pool rejects it as H-not-zero
 			// NOTE: Worst case scenario for a false positive: the pool rejects it as H-not-zero
@@ -4239,13 +4246,6 @@ next_write_sws_del:
 				continue;
 				continue;
 			}
 			}
 			
 			
-			if (fd == INVSOCK || (!pool->stratum_init) || (!pool->stratum_notify) || !FD_ISSET(fd, &wfds)) {
-next_write_sws:
-				// TODO: Check if stale, possibly discard etc
-				swsp = &sws->next;
-				continue;
-			}
-			
 			char *s = sws->s;
 			char *s = sws->s;
 			struct stratum_share *sshare = calloc(sizeof(struct stratum_share), 1);
 			struct stratum_share *sshare = calloc(sizeof(struct stratum_share), 1);
 			int sshare_id;
 			int sshare_id;