From d92609e665d5cd95cc9c6a1a82eae3fffe94a683 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sun, 28 Oct 2012 19:58:35 +1100 Subject: [PATCH] Fail on select() failing in stratum thread without needing to attempt recv_line. --- cgminer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cgminer.c b/cgminer.c index 8ec4f6ba..cbed74f6 100644 --- a/cgminer.c +++ b/cgminer.c @@ -4333,8 +4333,10 @@ static void *stratum_thread(void *userdata) * every minute so if we fail to receive any for 90 seconds we * assume the connection has been dropped and treat this pool * as dead */ - select(pool->sock + 1, &rd, NULL, NULL, &timeout); - s = recv_line(pool); + if (unlikely(select(pool->sock + 1, &rd, NULL, NULL, &timeout) < 1)) + s = NULL; + else + s = recv_line(pool); if (!s) { applog(LOG_INFO, "Stratum connection to pool %d interrupted", pool->pool_no); pool->getfail_occasions++;