From 28489fd6a83ea7420315881e96ecc4344b807620 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 11 Jan 2013 00:11:41 +0900 Subject: [PATCH] shrpx: Set TCP_NODELAY to downstream sockets --- src/shrpx_spdy_session.cc | 5 +++++ src/shrpx_spdy_upstream.cc | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/shrpx_spdy_session.cc b/src/shrpx_spdy_session.cc index c759780d..3c78379a 100644 --- a/src/shrpx_spdy_session.cc +++ b/src/shrpx_spdy_session.cc @@ -24,6 +24,7 @@ */ #include "shrpx_spdy_session.h" +#include #include #include @@ -225,6 +226,10 @@ void eventcb(bufferevent *bev, short events, void *ptr) spdy->disconnect(); return; } + int fd = bufferevent_getfd(bev); + int val = 1; + setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, + reinterpret_cast(&val), sizeof(val)); } else if(events & BEV_EVENT_EOF) { if(ENABLE_LOG) { SSLOG(INFO, spdy) << "EOF"; diff --git a/src/shrpx_spdy_upstream.cc b/src/shrpx_spdy_upstream.cc index 84cf1afa..f2e52950 100644 --- a/src/shrpx_spdy_upstream.cc +++ b/src/shrpx_spdy_upstream.cc @@ -24,6 +24,7 @@ */ #include "shrpx_spdy_upstream.h" +#include #include #include #include @@ -505,6 +506,10 @@ void spdy_downstream_eventcb(bufferevent *bev, short events, void *ptr) DCLOG(INFO, dconn) << "Connection established. stream_id=" << downstream->get_stream_id(); } + int fd = bufferevent_getfd(bev); + int val = 1; + setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, + reinterpret_cast(&val), sizeof(val)); } else if(events & BEV_EVENT_EOF) { if(ENABLE_LOG) { DCLOG(INFO, dconn) << "EOF. stream_id=" << downstream->get_stream_id();