Use the pool sock value directly in the stratum thread in case it changes after reconnecting.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/cgminer.c b/cgminer.c
index 0aba950..6a8e095 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -3964,18 +3964,17 @@ out_unlock:
static void *stratum_thread(void *userdata)
{
struct pool *pool = (struct pool *)userdata;
- SOCKETTYPE sock = pool->sock;
- fd_set rd;
pthread_detach(pthread_self());
- FD_ZERO(&rd);
- FD_SET(sock, &rd);
-
while (42) {
+ fd_set rd;
char *s;
- if (select(sock + 1, &rd, NULL, NULL, NULL) < 0) {
+ FD_ZERO(&rd);
+ FD_SET(pool->sock, &rd);
+
+ if (select(pool->sock + 1, &rd, NULL, NULL, NULL) < 0) {
pool->stratum_active = pool->stratum_auth = false;
applog(LOG_WARNING, "Stratum connection to pool %d interrupted", pool->pool_no);
pool->getfail_occasions++;
@@ -3984,7 +3983,7 @@ static void *stratum_thread(void *userdata)
break;
}
}
- s = recv_line(sock);
+ s = recv_line(pool->sock);
if (unlikely(!s))
continue;
if (!parse_stratum(pool, s)) /* Create message queues here */