Skip to content

Commit

Permalink
Net: Set TCP_NODELAY
Browse files Browse the repository at this point in the history
Fixes #336
  • Loading branch information
solardiz committed Sep 24, 2024
1 parent 7cfd143 commit 0c28110
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/modules/net/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ static void maybe_reconnect(void)
}

sk->sk->sk_sndtimeo = HZ;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0)
tcp_sock_set_nodelay(sk->sk);
#else
int one = 1;
kernel_setsockopt(sk, SOL_TCP, TCP_NODELAY, (char *)&one, sizeof(one));
#endif

saddr.sin_family = AF_INET;
saddr.sin_port = htons(net_server_port);
Expand Down

0 comments on commit 0c28110

Please sign in to comment.