mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 15:27:53 +00:00
Don't wait on select when first detecting stratum, just receive one line.
This commit is contained in:
parent
210bc9be3e
commit
496af92afd
15
util.c
15
util.c
@ -897,18 +897,14 @@ static void clear_sock(SOCKETTYPE sock)
|
||||
}
|
||||
|
||||
/* Check to see if Santa's been good to you */
|
||||
static bool sock_full(SOCKETTYPE sock, bool wait)
|
||||
static bool sock_full(SOCKETTYPE sock)
|
||||
{
|
||||
struct timeval timeout;
|
||||
fd_set rd;
|
||||
|
||||
FD_ZERO(&rd);
|
||||
FD_SET(sock, &rd);
|
||||
timeout.tv_usec = 0;
|
||||
if (wait)
|
||||
timeout.tv_sec = 60;
|
||||
else
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = timeout.tv_sec = 0;
|
||||
if (select(sock + 1, &rd, NULL, NULL, &timeout) > 0)
|
||||
return true;
|
||||
return false;
|
||||
@ -1141,7 +1137,7 @@ bool auth_stratum(struct pool *pool)
|
||||
swork_id++, pool->rpc_user, pool->rpc_pass);
|
||||
|
||||
/* Parse all data prior sending auth request */
|
||||
while (sock_full(pool->sock, false)) {
|
||||
while (sock_full(pool->sock)) {
|
||||
sret = recv_line(pool->sock);
|
||||
if (!parse_method(pool, sret)) {
|
||||
clear_sock(pool->sock);
|
||||
@ -1212,11 +1208,6 @@ bool initiate_stratum(struct pool *pool)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!sock_full(pool->sock, true)) {
|
||||
applog(LOG_DEBUG, "Timed out waiting for response in initiate_stratum");
|
||||
goto out;
|
||||
}
|
||||
|
||||
sret = recv_line(pool->sock);
|
||||
if (!sret)
|
||||
goto out;
|
||||
|
Loading…
Reference in New Issue
Block a user