summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-04-28 13:30:32 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-04-28 13:30:32 -0700
commit5670ff7199099394e08796cb8a8c389e6e4d5220 (patch)
treef8d7ead1e54bd92b9fecfbc327e8ea5202b12750 /src/common
parent879e4c930410ddf8d223d6aeefcf0d1eb5d52ccd (diff)
parent6b83d27d53e24bfe7c37e9f7578cfec9540aae1f (diff)
downloadtmwa-5670ff7199099394e08796cb8a8c389e6e4d5220.tar.gz
tmwa-5670ff7199099394e08796cb8a8c389e6e4d5220.tar.bz2
tmwa-5670ff7199099394e08796cb8a8c389e6e4d5220.tar.xz
tmwa-5670ff7199099394e08796cb8a8c389e6e4d5220.zip
Merge branch 'master' into test
Conflicts: src/char/char.cpp src/common/socket.cpp src/map/map.cpp
Diffstat (limited to 'src/common')
-rw-r--r--src/common/socket.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/common/socket.cpp b/src/common/socket.cpp
index a8c1eee..ae89757 100644
--- a/src/common/socket.cpp
+++ b/src/common/socket.cpp
@@ -143,10 +143,19 @@ void connect_client(int listen_fd)
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof yes);
/// Send packets as soon as possible
/// even if the kernel thinks there is too little for it to be worth it!
- // I'm not convinced this is a good idea; although in minimizes the
- // latency for an individual write, it increases traffic in general.
+ /// Testing shows this is indeed a good idea.
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &yes, sizeof yes);
+ // Linux-ism: Set socket options to optimize for thin streams
+ // See http://lwn.net/Articles/308919/ and
+ // Documentation/networking/tcp-thin.txt .. Kernel 3.2+
+#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
+
FD_SET(fd, &readfds);
fcntl(fd, F_SETFL, O_NONBLOCK);