mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-05 11:34:16 +00:00
Check for errors on stratum recv for any recv return value less than 1 and only parse the response if it's positive.
This commit is contained in:
parent
baa5a6e7a7
commit
e95695dbc7
22
util.c
22
util.c
@ -1104,17 +1104,19 @@ char *recv_line(struct pool *pool)
|
||||
|
||||
memset(s, 0, RBUFSIZE);
|
||||
n = recv(pool->sock, s, RECVSIZE, 0);
|
||||
if (!n) {
|
||||
ret = RECV_CLOSED;
|
||||
break;
|
||||
if (n < 1) {
|
||||
if (errno != EAGAIN && errno != EWOULDBLOCK) {
|
||||
if (n == 0)
|
||||
ret = RECV_CLOSED;
|
||||
else
|
||||
ret = RECV_RECVFAIL;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
slen = strlen(s);
|
||||
recalloc_sock(pool, slen);
|
||||
strcat(pool->sockbuf, s);
|
||||
}
|
||||
if (n < 0 && errno != EAGAIN && errno != EWOULDBLOCK) {
|
||||
ret = RECV_RECVFAIL;
|
||||
break;
|
||||
}
|
||||
slen = strlen(s);
|
||||
recalloc_sock(pool, slen);
|
||||
strcat(pool->sockbuf, s);
|
||||
cgtime(&now);
|
||||
} while (tdiff(&now, &rstart) < 60 && !strstr(pool->sockbuf, "\n"));
|
||||
mutex_unlock(&pool->stratum_lock);
|
||||
|
Loading…
x
Reference in New Issue
Block a user