Browse Source

Merge commit '944af31' into cg_merges_20121226

Luke Dashjr 13 years ago
parent
commit
e5f2ed1520
3 changed files with 4 additions and 3 deletions
  1. 2 2
      miner.c
  2. 1 1
      util.c
  3. 1 0
      util.h

+ 2 - 2
miner.c

@@ -5631,7 +5631,7 @@ static void *stratum_thread(void *userdata)
 		/* Check to see whether we need to maintain this connection
 		 * indefinitely or just bring it up when we switch to this
 		 * pool */
-		if (!cnx_needed(pool)) {
+		if (!sock_full(pool, false) && !cnx_needed(pool)) {
 			suspend_stratum(pool);
 			clear_stratum_shares(pool);
 			clear_pool_work(pool);
@@ -5655,7 +5655,7 @@ static void *stratum_thread(void *userdata)
 		/* If we fail to receive any notify messages for 2 minutes we
 		 * assume the connection has been dropped and treat this pool
 		 * as dead */
-		if (unlikely(select(pool->sock + 1, &rd, NULL, NULL, &timeout) < 1))
+		if (!sock_full(pool, false) && select(pool->sock + 1, &rd, NULL, NULL, &timeout) < 1)
 			s = NULL;
 		else
 			s = recv_line(pool);

+ 1 - 1
util.c

@@ -1024,7 +1024,7 @@ bool stratum_send(struct pool *pool, char *s, ssize_t len)
 }
 
 /* Check to see if Santa's been good to you */
-static bool sock_full(struct pool *pool, bool wait)
+bool sock_full(struct pool *pool, bool wait)
 {
 	SOCKETTYPE sock = pool->sock;
 	struct timeval timeout;

+ 1 - 0
util.h

@@ -59,6 +59,7 @@ extern bool hash_target_check(const unsigned char *hash, const unsigned char *ta
 extern bool hash_target_check_v(const unsigned char *hash, const unsigned char *target);
 
 bool stratum_send(struct pool *pool, char *s, ssize_t len);
+bool sock_full(struct pool *pool, bool wait);
 char *recv_line(struct pool *pool);
 bool parse_method(struct pool *pool, char *s);
 bool extract_sockaddr(struct pool *pool, char *url);