shrpx: Set TCP_NODELAY to downstream sockets

This commit is contained in:
Tatsuhiro Tsujikawa 2013-01-11 00:11:41 +09:00
parent e454cc1301
commit 28489fd6a8
2 changed files with 10 additions and 0 deletions

View File

@ -24,6 +24,7 @@
*/
#include "shrpx_spdy_session.h"
#include <netinet/tcp.h>
#include <unistd.h>
#include <vector>
@ -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<char *>(&val), sizeof(val));
} else if(events & BEV_EVENT_EOF) {
if(ENABLE_LOG) {
SSLOG(INFO, spdy) << "EOF";

View File

@ -24,6 +24,7 @@
*/
#include "shrpx_spdy_upstream.h"
#include <netinet/tcp.h>
#include <assert.h>
#include <cerrno>
#include <sstream>
@ -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<char *>(&val), sizeof(val));
} else if(events & BEV_EVENT_EOF) {
if(ENABLE_LOG) {
DCLOG(INFO, dconn) << "EOF. stream_id=" << downstream->get_stream_id();