diff options
author | Haruna <haru@dotalux.com> | 2014-12-27 02:08:31 +0100 |
---|---|---|
committer | Haruna <haru@dotalux.com> | 2014-12-27 02:08:31 +0100 |
commit | 94f9b49c1594bf318d916de7938f6145999a23f4 (patch) | |
tree | bb525335518380493144e6d558907c096d73acc8 | |
parent | 73e97a7ef8bd7b63e82f7817f17426db8bfc8949 (diff) | |
parent | 71efeed0e7c8b847172549d76c47f859327150bc (diff) | |
download | hercules-94f9b49c1594bf318d916de7938f6145999a23f4.tar.gz hercules-94f9b49c1594bf318d916de7938f6145999a23f4.tar.bz2 hercules-94f9b49c1594bf318d916de7938f6145999a23f4.tar.xz hercules-94f9b49c1594bf318d916de7938f6145999a23f4.zip |
Merge pull request #422 from 4144/thinsock
In linux enable thin-stream mode.
Note: If anyone has a reason to disable this, please tell us, and we'll turn it into a compile-time option.
-rw-r--r-- | src/common/socket.c | 11 |
1 files changed, 11 insertions, 0 deletions
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 <errno.h> # include <net/if.h> # include <netdb.h> +#if defined __linux__ || defined __linux +# include <linux/tcp.h> +#else # include <netinet/in.h> # include <netinet/tcp.h> +#endif # include <sys/ioctl.h> # include <sys/socket.h> # include <sys/time.h> @@ -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 } /*====================================== |