mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 12:34:27 +00:00
Use TCP_NODELAY with raw sockets if !opt_delaynet
This commit is contained in:
parent
527fe05848
commit
0676a1a885
9
util.c
9
util.c
@ -203,12 +203,13 @@ static void keep_sockalive(SOCKETTYPE fd)
|
||||
{
|
||||
const int tcp_keepidle = 45;
|
||||
const int tcp_keepintvl = 30;
|
||||
const int keepalive = 1;
|
||||
const int tcp_keepcnt = 1;
|
||||
const int tcp_one = 1;
|
||||
|
||||
setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (const void *)&keepalive, sizeof(keepalive));
|
||||
setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (const void *)&tcp_one, sizeof(tcp_one));
|
||||
if (!opt_delaynet)
|
||||
setsockopt(fd, SOL_TCP, TCP_NODELAY, (const void *)&tcp_one, sizeof(tcp_one));
|
||||
# ifdef __linux
|
||||
setsockopt(fd, SOL_TCP, TCP_KEEPCNT, &tcp_keepcnt, sizeof(tcp_keepcnt));
|
||||
setsockopt(fd, SOL_TCP, TCP_KEEPCNT, &tcp_one, sizeof(tcp_one));
|
||||
setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, &tcp_keepidle, sizeof(tcp_keepidle));
|
||||
setsockopt(fd, SOL_TCP, TCP_KEEPINTVL, &tcp_keepintvl, sizeof(tcp_keepintvl));
|
||||
# endif /* __linux */
|
||||
|
Loading…
x
Reference in New Issue
Block a user