diff options
| author | Wladimir J. van der Laan <[email protected]> | 2015-10-23 09:29:20 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2015-10-23 09:29:49 +0200 |
| commit | b2b173acabea78f5e613db3d0cdf5e23aeed1e9a (patch) | |
| tree | 270790adb3840c7e29587cdaf9e6f44bfd1beaa3 /src/netbase.cpp | |
| parent | Merge pull request #6848 (diff) | |
| parent | Set TCP_NODELAY on P2P sockets. (diff) | |
| download | discoin-b2b173acabea78f5e613db3d0cdf5e23aeed1e9a.tar.xz discoin-b2b173acabea78f5e613db3d0cdf5e23aeed1e9a.zip | |
Merge pull request #6867
a4e28b3 Set TCP_NODELAY on P2P sockets. (Gregory Maxwell)
Diffstat (limited to 'src/netbase.cpp')
| -rw-r--r-- | src/netbase.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp index c3d56d918..f5316965c 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -444,12 +444,19 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe if (hSocket == INVALID_SOCKET) return false; -#ifdef SO_NOSIGPIPE int set = 1; +#ifdef SO_NOSIGPIPE // Different way of disabling SIGPIPE on BSD setsockopt(hSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&set, sizeof(int)); #endif + //Disable Nagle's algorithm +#ifdef WIN32 + setsockopt(hSocket, IPPROTO_TCP, TCP_NODELAY, (const char*)&set, sizeof(int)); +#else + setsockopt(hSocket, IPPROTO_TCP, TCP_NODELAY, (void*)&set, sizeof(int)); +#endif + // Set to non-blocking if (!SetSocketNonBlocking(hSocket, true)) return error("ConnectSocketDirectly: Setting socket to non-blocking failed, error %s\n", NetworkErrorString(WSAGetLastError())); |