|
|
@ -929,16 +929,12 @@ bool stratum_send(struct pool *pool, char *s, ssize_t len) |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Check to see if Santa's been good to you */ |
|
|
|
static bool socket_full(struct pool *pool, bool wait) |
|
|
|
bool sock_full(struct pool *pool, bool wait) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
SOCKETTYPE sock = pool->sock; |
|
|
|
SOCKETTYPE sock = pool->sock; |
|
|
|
struct timeval timeout; |
|
|
|
struct timeval timeout; |
|
|
|
fd_set rd; |
|
|
|
fd_set rd; |
|
|
|
|
|
|
|
|
|
|
|
if (strlen(pool->sockbuf)) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FD_ZERO(&rd); |
|
|
|
FD_ZERO(&rd); |
|
|
|
FD_SET(sock, &rd); |
|
|
|
FD_SET(sock, &rd); |
|
|
|
timeout.tv_usec = 0; |
|
|
|
timeout.tv_usec = 0; |
|
|
@ -951,6 +947,15 @@ bool sock_full(struct pool *pool, bool wait) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Check to see if Santa's been good to you */ |
|
|
|
|
|
|
|
bool sock_full(struct pool *pool) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (strlen(pool->sockbuf)) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (socket_full(pool, false)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void clear_sock(struct pool *pool) |
|
|
|
static void clear_sock(struct pool *pool) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ssize_t n; |
|
|
|
ssize_t n; |
|
|
@ -975,8 +980,8 @@ char *recv_line(struct pool *pool) |
|
|
|
char s[RBUFSIZE]; |
|
|
|
char s[RBUFSIZE]; |
|
|
|
size_t sspace; |
|
|
|
size_t sspace; |
|
|
|
|
|
|
|
|
|
|
|
if (!sock_full(pool, true)) { |
|
|
|
if (!socket_full(pool, true)) { |
|
|
|
applog(LOG_DEBUG, "Timed out waiting for data on sock_full"); |
|
|
|
applog(LOG_DEBUG, "Timed out waiting for data on socket_full"); |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
memset(s, 0, RBUFSIZE); |
|
|
|
memset(s, 0, RBUFSIZE); |
|
|
@ -1385,7 +1390,7 @@ bool initiate_stratum(struct pool *pool) |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!sock_full(pool, true)) { |
|
|
|
if (!socket_full(pool, true)) { |
|
|
|
applog(LOG_DEBUG, "Timed out waiting for response in initiate_stratum"); |
|
|
|
applog(LOG_DEBUG, "Timed out waiting for response in initiate_stratum"); |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|