Browse Source

Test for SO_NOSIGPIPE rather than assuming all BSDs support it.

Signed-off-by: Jeff Garzik <jgarzik@exmulti.com>
miguelfreitas
Venkatesh Srinivas 13 years ago committed by Jeff Garzik
parent
commit
ec93a0e219
  1. 4
      src/net.cpp

4
src/net.cpp

@ -98,7 +98,7 @@ bool ConnectSocket(const CAddress& addrConnect, SOCKET& hSocketRet, int nTimeout
SOCKET hSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); SOCKET hSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (hSocket == INVALID_SOCKET) if (hSocket == INVALID_SOCKET)
return false; return false;
#ifdef BSD #ifdef SO_NOSIGPIPE
int set = 1; int set = 1;
setsockopt(hSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&set, sizeof(int)); setsockopt(hSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&set, sizeof(int));
#endif #endif
@ -1584,7 +1584,7 @@ bool BindListenPort(string& strError)
return false; return false;
} }
#ifdef BSD #ifdef SO_NOSIGPIPE
// Different way of disabling SIGPIPE on BSD // Different way of disabling SIGPIPE on BSD
setsockopt(hListenSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&nOne, sizeof(int)); setsockopt(hListenSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&nOne, sizeof(int));
#endif #endif

Loading…
Cancel
Save