From 0f19915421fb2398fb4753bf2d427ef5c447c0dd Mon Sep 17 00:00:00 2001 From: Mikhail Burakov Date: Sun, 5 May 2024 15:15:45 +0200 Subject: Set TCP_NODELAY on accepted client connections --- main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.c b/main.c index 7bd2c7b..a180bca 100644 --- a/main.c +++ b/main.c @@ -17,11 +17,13 @@ #include #include +#include #include #include #include #include #include +#include #include #include "capture.h" @@ -228,6 +230,11 @@ static void OnClientConnecting(void* user) { return; } + if (setsockopt(client_fd, IPPROTO_TCP, TCP_NODELAY, &(int){1}, sizeof(int))) { + LOG("Failed to set TCP_NODELAY (%s)", strerror(errno)); + goto drop_client; + } + contexts->client_fd = client_fd; if (!IoMuxerOnRead(&contexts->io_muxer, contexts->client_fd, &OnClientWriting, user)) { -- cgit v1.2.3