Test for SO_NOSIGPIPE rather than assuming all BSDs support it.
authorVenkatesh Srinivas <me@endeavour.zapto.org>
Sun, 7 Aug 2011 16:18:05 +0000 (12:18 -0400)
committerJeff Garzik <jgarzik@pobox.com>
Thu, 11 Aug 2011 02:36:20 +0000 (22:36 -0400)
Signed-off-by: Jeff Garzik <jgarzik@exmulti.com>

src/net.cpp

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