From bdff9d1f9a623ba4acee426550c56d360c9cd44d Mon Sep 17 00:00:00 2001 From: shanth96 Date: Wed, 13 Sep 2023 22:59:59 +0400 Subject: [PATCH] set tcpnodelay --- src/socket.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/socket.c b/src/socket.c index fc0eb624..720b4b7d 100644 --- a/src/socket.c +++ b/src/socket.c @@ -195,6 +195,12 @@ static int raw_connect_internal(struct trilogy_sock *sock, const struct addrinfo return TRILOGY_SYSERR; } +#ifdef TCP_NODELAY + int flags = 1; + if (setsockopt(sock->fd, IPPROTO_TCP, TCP_NODELAY, (void *)&flags, sizeof(flags)) < 0) { + goto fail; + } +#endif if (sock->base.opts.keepalive_enabled) { int flags = 1; if (setsockopt(sock->fd, SOL_SOCKET, SO_KEEPALIVE, (void *)&flags, sizeof(flags)) < 0) {