Check for EWOULDBLOCK when supported in send and recv as well.
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/miner.h b/miner.h
index 1b668ff..7f5b6c8 100644
--- a/miner.h
+++ b/miner.h
@@ -60,6 +60,10 @@ static inline int fsync (int fd)
return (FlushFileBuffers ((HANDLE) _get_osfhandle (fd))) ? 0 : -1;
}
+#ifndef EWOULDBLOCK
+# define EWOULDBLOCK EAGAIN
+#endif
+
#ifndef MSG_DONTWAIT
# define MSG_DONTWAIT 0x1000000
#endif
diff --git a/util.c b/util.c
index b10b4e9..32d95d2 100644
--- a/util.c
+++ b/util.c
@@ -900,7 +900,7 @@ static bool __stratum_send(struct pool *pool, char *s, ssize_t len)
}
sent = send(pool->sock, s + ssent, len, 0);
if (sent < 0) {
- if (errno != EAGAIN) {
+ if (errno != EAGAIN && errno != EWOULDBLOCK) {
applog(LOG_DEBUG, "Failed to curl_easy_send in stratum_send");
return false;
}
@@ -985,7 +985,7 @@ char *recv_line(struct pool *pool)
n = recv(pool->sock, s, RECVSIZE, 0);
mutex_unlock(&pool->stratum_lock);
- if (n < 1 && errno != EAGAIN) {
+ if (n < 1 && errno != EAGAIN && errno != EWOULDBLOCK) {
applog(LOG_DEBUG, "Failed to recv sock in recv_line");
goto out;
}