1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-25 14:04:25 +00:00

Small timeouts on select() instead of instant timeout increase reliability of socket reads and writes.

This commit is contained in:
Con Kolivas 2013-04-06 15:49:55 +11:00
parent 7783ab5631
commit 1e14748c68

4
util.c
View File

@ -912,7 +912,7 @@ static bool __stratum_send(struct pool *pool, char *s, ssize_t len)
len++; len++;
while (len > 0 ) { while (len > 0 ) {
struct timeval timeout = {0, 0}; struct timeval timeout = {1, 0};
ssize_t sent; ssize_t sent;
fd_set wd; fd_set wd;
@ -966,7 +966,7 @@ static bool socket_full(struct pool *pool, bool wait)
if (wait) if (wait)
timeout.tv_sec = 60; timeout.tv_sec = 60;
else else
timeout.tv_sec = 0; timeout.tv_sec = 1;
if (select(sock + 1, &rd, NULL, NULL, &timeout) > 0) if (select(sock + 1, &rd, NULL, NULL, &timeout) > 0)
return true; return true;
return false; return false;