From b0b061ef8b304b014e12edfb7263c71093d50b44 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 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/socket.c b/src/socket.c index fc0eb624..d031589b 100644 --- a/src/socket.c +++ b/src/socket.c @@ -195,6 +195,14 @@ static int raw_connect_internal(struct trilogy_sock *sock, const struct addrinfo return TRILOGY_SYSERR; } +#ifdef TCP_NODELAY + if (sock->addr->ai_family != PF_UNIX) { + 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) {