|
|
|
@ -203,12 +203,13 @@ static void keep_sockalive(SOCKETTYPE fd)
@@ -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 */ |
|
|
|
|