From 71efeed0e7c8b847172549d76c47f859327150bc Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 25 Dec 2014 00:02:48 +0300 Subject: In linux enable thin-stream mode. It should reduce latency in some cases. See more info here: https://www.kernel.org/doc/Documentation/networking/tcp-thin.txt --- src/common/socket.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/common/socket.c b/src/common/socket.c index f307dc4a9..09521c312 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -29,8 +29,12 @@ # include # include # include +#if defined __linux__ || defined __linux +# include +#else # include # include +#endif # include # include # include @@ -333,6 +337,13 @@ void setsocketopts(int fd, struct hSockOpt *opt) { lopt.l_linger = 0; // Do not care if( sSetsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&lopt, sizeof(lopt)) ) ShowWarning("setsocketopts: Unable to set SO_LINGER mode for connection #%d!\n", fd); + +#ifdef TCP_THIN_LINEAR_TIMEOUTS + setsockopt(fd, IPPROTO_TCP, TCP_THIN_LINEAR_TIMEOUTS, &yes, sizeof yes); +#endif +#ifdef TCP_THIN_DUPACK + setsockopt(fd, IPPROTO_TCP, TCP_THIN_DUPACK, &yes, sizeof yes); +#endif } /*====================================== -- cgit v1.2.3-60-g2f50