diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-04-12 19:52:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-04-12 21:23:40 +0300 |
commit | c565936b3ac5b6e1ab0d5ca30963619c7b725bb6 (patch) | |
tree | 8e15e8d1ce53622414aa6caeca2b8fa2b0801e1c /src | |
parent | 351821c1f18f9285be58df0a05339936311f6490 (diff) | |
download | manaverse-c565936b3ac5b6e1ab0d5ca30963619c7b725bb6.tar.gz manaverse-c565936b3ac5b6e1ab0d5ca30963619c7b725bb6.tar.bz2 manaverse-c565936b3ac5b6e1ab0d5ca30963619c7b725bb6.tar.xz manaverse-c565936b3ac5b6e1ab0d5ca30963619c7b725bb6.zip |
fix tcp tuning options usage.
Diffstat (limited to 'src')
-rw-r--r-- | src/localconsts.h | 1 | ||||
-rw-r--r-- | src/net/sdltcpnet.cpp | 19 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/localconsts.h b/src/localconsts.h index ba803ca86..d6c535640 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -39,6 +39,7 @@ #endif #undef Z_NULL #define Z_NULL nullptr +#define M_TCPOK #define A_DELETE(func) func = delete #define A_DELETE_COPY(name) name(const name &) = delete; \ name &operator=(const name&) = delete; diff --git a/src/net/sdltcpnet.cpp b/src/net/sdltcpnet.cpp index 6ad350002..b38bc8a67 100644 --- a/src/net/sdltcpnet.cpp +++ b/src/net/sdltcpnet.cpp @@ -21,9 +21,24 @@ #include "net/sdltcpnet.h" #if defined __linux__ || defined __linux +#include "logger.h" + #include <sys/socket.h> -#include <linux/tcp.h> +#include <netinet/in.h> +#include <netinet/tcp.h> #include <netdb.h> + +#if defined(M_TCPOK) && !defined(ANDROID) +#include <linux/tcp.h> +#else +// using manual hack, because in this mode linux/tcp.h compiled with errors +#include <netinet/tcp.h> +// Use linear timeouts for thin streams +#define TCP_THIN_LINEAR_TIMEOUTS 16 +// Fast retrans. after 1 dupack +#define TCP_THIN_DUPACK 17 +#endif + #endif #include "debug.h" @@ -67,8 +82,6 @@ int TcpNet::resolveHost(IPaddress *address, const char *host, Uint16 port) return SDLNet_ResolveHost(address, host, port); } -#include "logger.h" - TcpNet::Socket TcpNet::open(IPaddress *ip) { TcpNet::Socket sock = SDLNet_TCP_Open(ip); |