From 34b7ae04eaa4bed74a5b4019069fd2401cd91e50 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Mon, 4 Jul 2022 16:19:01 +0200 Subject: [PATCH] Set TCP_NODELAY on in and outgoing TCP --- pdns/lwres.cc | 1 + pdns/recursordist/rec-tcp.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/pdns/lwres.cc b/pdns/lwres.cc index ba064ec26b..c8f2ce2c0d 100644 --- a/pdns/lwres.cc +++ b/pdns/lwres.cc @@ -261,6 +261,7 @@ static bool tcpconnect(const struct timeval& now, const ComboAddress& ip, TCPOut const struct timeval timeout{ g_networkTimeoutMsec / 1000, static_cast(g_networkTimeoutMsec) % 1000 * 1000}; Socket s(ip.sin4.sin_family, SOCK_STREAM); s.setNonBlocking(); + setTCPNoDelay(s.getHandle()); ComboAddress localip = pdns::getQueryLocalAddress(ip.sin4.sin_family, 0); s.bind(localip); diff --git a/pdns/recursordist/rec-tcp.cc b/pdns/recursordist/rec-tcp.cc index d15fa64d13..f395239555 100644 --- a/pdns/recursordist/rec-tcp.cc +++ b/pdns/recursordist/rec-tcp.cc @@ -654,6 +654,7 @@ void handleNewTCPQuestion(int fd, FDMultiplexer::funcparam_t&) } setNonBlocking(newsock); + setTCPNoDelay(newsock); std::shared_ptr tc = std::make_shared(newsock, addr); tc->d_source = addr; tc->d_destination.reset(); -- 2.47.2