From f9a3447bc9f751f29ccb729d57b189da163175c4 Mon Sep 17 00:00:00 2001 From: nick Date: Tue, 25 Feb 2014 15:59:05 +0000 Subject: [PATCH] proxy: Turn on TCP_NODELAY for the proxy->upstream leg Nagle doesn't actually affect us too badly here, as we don't write the header and then the data in two separate calls under normal circumstances, which is the pathological case, but we should have NODELAY on, regardless --- src/proxy/proxy.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/proxy/proxy.c b/src/proxy/proxy.c index 4f66b4e..043a36c 100644 --- a/src/proxy/proxy.c +++ b/src/proxy/proxy.c @@ -186,6 +186,13 @@ void proxy_finish_connect_to_upstream( struct proxier *proxy, off64_t size ) { } proxy->upstream_size = size; + + if ( AF_UNIX != proxy->connect_to.family ) { + if ( sock_set_tcp_nodelay( proxy->upstream_fd, 1 ) == -1 ) { + warn( SHOW_ERRNO( "Failed to set TCP_NODELAY" ) ); + } + } + info( "Connected to upstream on fd %i", proxy->upstream_fd ); return;