|
|
@ -428,18 +428,14 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe |
|
|
|
if (hSocket == INVALID_SOCKET) |
|
|
|
if (hSocket == INVALID_SOCKET) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
int set = 1; |
|
|
|
|
|
|
|
#ifdef SO_NOSIGPIPE |
|
|
|
#ifdef SO_NOSIGPIPE |
|
|
|
|
|
|
|
int set = 1; |
|
|
|
// Different way of disabling SIGPIPE on BSD
|
|
|
|
// Different way of disabling SIGPIPE on BSD
|
|
|
|
setsockopt(hSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&set, sizeof(int)); |
|
|
|
setsockopt(hSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&set, sizeof(int)); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
//Disable Nagle's algorithm
|
|
|
|
//Disable Nagle's algorithm
|
|
|
|
#ifdef WIN32 |
|
|
|
SetSocketNoDelay(hSocket); |
|
|
|
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
|
|
|
|
// Set to non-blocking
|
|
|
|
if (!SetSocketNonBlocking(hSocket, true)) |
|
|
|
if (!SetSocketNonBlocking(hSocket, true)) |
|
|
@ -728,6 +724,13 @@ bool SetSocketNonBlocking(SOCKET& hSocket, bool fNonBlocking) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool SetSocketNoDelay(SOCKET& hSocket) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
int set = 1; |
|
|
|
|
|
|
|
int rc = setsockopt(hSocket, IPPROTO_TCP, TCP_NODELAY, (const char*)&set, sizeof(int)); |
|
|
|
|
|
|
|
return rc == 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void InterruptSocks5(bool interrupt) |
|
|
|
void InterruptSocks5(bool interrupt) |
|
|
|
{ |
|
|
|
{ |
|
|
|
interruptSocks5Recv = interrupt; |
|
|
|
interruptSocks5Recv = interrupt; |
|
|
|