mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Recv() should all be non-blocking for raw sockets in stratum.
This commit is contained in:
parent
cf80fe4a63
commit
6e969e93e2
14
util.c
14
util.c
@ -1033,13 +1033,11 @@ static void clear_sock(struct pool *pool)
|
|||||||
{
|
{
|
||||||
ssize_t n;
|
ssize_t n;
|
||||||
|
|
||||||
if (socket_full(pool, false)) {
|
mutex_lock(&pool->stratum_lock);
|
||||||
mutex_lock(&pool->stratum_lock);
|
do {
|
||||||
do {
|
n = recv(pool->sock, pool->sockbuf, RECVSIZE, MSG_DONTWAIT);
|
||||||
n = recv(pool->sock, pool->sockbuf, RECVSIZE, 0);
|
} while (n > 0);
|
||||||
} while (n > 0);
|
mutex_unlock(&pool->stratum_lock);
|
||||||
mutex_unlock(&pool->stratum_lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
clear_sockbuf(pool);
|
clear_sockbuf(pool);
|
||||||
}
|
}
|
||||||
@ -1095,7 +1093,7 @@ char *recv_line(struct pool *pool)
|
|||||||
ssize_t n;
|
ssize_t n;
|
||||||
|
|
||||||
memset(s, 0, RBUFSIZE);
|
memset(s, 0, RBUFSIZE);
|
||||||
n = recv(pool->sock, s, RECVSIZE, 0);
|
n = recv(pool->sock, s, RECVSIZE, MSG_DONTWAIT);
|
||||||
if (!n) {
|
if (!n) {
|
||||||
ret = RECV_CLOSED;
|
ret = RECV_CLOSED;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user