From a66a67c2ab50aee3f17015eb48df92e11d9597a1 Mon Sep 17 00:00:00 2001 From: mjagdis Date: Fri, 31 May 2024 12:04:51 +0100 Subject: Set TCP_NODELAY on connections (#5558) * Set TCP_NODELAY on connections Signed-off-by: Mike Jagdis * Windows wants a char * not a void * :-( Signed-off-by: Mike Jagdis * And clang objects to old style casts Signed-off-by: Mike Jagdis --------- Signed-off-by: Mike Jagdis --- src/OSSupport/ServerHandleImpl.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/OSSupport/ServerHandleImpl.cpp') diff --git a/src/OSSupport/ServerHandleImpl.cpp b/src/OSSupport/ServerHandleImpl.cpp index e68f82757..669a0f83f 100644 --- a/src/OSSupport/ServerHandleImpl.cpp +++ b/src/OSSupport/ServerHandleImpl.cpp @@ -328,6 +328,9 @@ void cServerHandleImpl::Callback(evconnlistener * a_Listener, evutil_socket_t a_ return; } + const int one = 1; + setsockopt(a_Socket, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast(&one), sizeof(one)); + // Create a new cTCPLink for the incoming connection: cTCPLinkImplPtr Link = std::make_shared(a_Socket, LinkCallbacks, Self->m_SelfPtr, a_Addr, static_cast(a_Len)); { -- cgit v1.2.3