mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 15:27:53 +00:00
Differentiate socket closed from socket error in recv_line.
This commit is contained in:
parent
86821eb45d
commit
c6ca12f084
9
util.c
9
util.c
@ -1038,11 +1038,16 @@ char *recv_line(struct pool *pool)
|
|||||||
mutex_lock(&pool->stratum_lock);
|
mutex_lock(&pool->stratum_lock);
|
||||||
do {
|
do {
|
||||||
char s[RBUFSIZE];
|
char s[RBUFSIZE];
|
||||||
size_t slen, n;
|
size_t slen;
|
||||||
|
ssize_t n;
|
||||||
|
|
||||||
memset(s, 0, RBUFSIZE);
|
memset(s, 0, RBUFSIZE);
|
||||||
n = recv(pool->sock, s, RECVSIZE, 0);
|
n = recv(pool->sock, s, RECVSIZE, 0);
|
||||||
if (n < 1 && errno != EAGAIN && errno != EWOULDBLOCK) {
|
if (!n) {
|
||||||
|
applog(LOG_DEBUG, "Socket closed waiting in recv_line");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (n < 0 && errno != EAGAIN && errno != EWOULDBLOCK) {
|
||||||
applog(LOG_DEBUG, "Failed to recv sock in recv_line");
|
applog(LOG_DEBUG, "Failed to recv sock in recv_line");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user