1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-22 20:44:19 +00:00

Check for EWOULDBLOCK when supported in send and recv as well.

This commit is contained in:
Con Kolivas 2012-12-14 21:36:42 +11:00
parent 2274af6a05
commit cada0d3195
2 changed files with 6 additions and 2 deletions

View File

@ -60,6 +60,10 @@ static inline int fsync (int fd)
return (FlushFileBuffers ((HANDLE) _get_osfhandle (fd))) ? 0 : -1; return (FlushFileBuffers ((HANDLE) _get_osfhandle (fd))) ? 0 : -1;
} }
#ifndef EWOULDBLOCK
# define EWOULDBLOCK EAGAIN
#endif
#ifndef MSG_DONTWAIT #ifndef MSG_DONTWAIT
# define MSG_DONTWAIT 0x1000000 # define MSG_DONTWAIT 0x1000000
#endif #endif

4
util.c
View File

@ -900,7 +900,7 @@ static bool __stratum_send(struct pool *pool, char *s, ssize_t len)
} }
sent = send(pool->sock, s + ssent, len, 0); sent = send(pool->sock, s + ssent, len, 0);
if (sent < 0) { if (sent < 0) {
if (errno != EAGAIN) { if (errno != EAGAIN && errno != EWOULDBLOCK) {
applog(LOG_DEBUG, "Failed to curl_easy_send in stratum_send"); applog(LOG_DEBUG, "Failed to curl_easy_send in stratum_send");
return false; return false;
} }
@ -985,7 +985,7 @@ char *recv_line(struct pool *pool)
n = recv(pool->sock, s, RECVSIZE, 0); n = recv(pool->sock, s, RECVSIZE, 0);
mutex_unlock(&pool->stratum_lock); 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"); applog(LOG_DEBUG, "Failed to recv sock in recv_line");
goto out; goto out;
} }