@@ -2078,44 +2078,21 @@ bool CConnman::BindListenPort(const CService &addrBind, std::string& strError, b
2078
2078
return false ;
2079
2079
}
2080
2080
2081
- SOCKET hListenSocket = socket ((( struct sockaddr *)&sockaddr)-> sa_family , SOCK_STREAM, IPPROTO_TCP );
2081
+ SOCKET hListenSocket = CreateSocket (addrBind );
2082
2082
if (hListenSocket == INVALID_SOCKET)
2083
2083
{
2084
2084
strError = strprintf (" Error: Couldn't open socket for incoming connections (socket returned error %s)" , NetworkErrorString (WSAGetLastError ()));
2085
2085
LogPrintf (" %s\n " , strError);
2086
2086
return false ;
2087
2087
}
2088
- if (!IsSelectableSocket (hListenSocket))
2089
- {
2090
- strError = " Error: Couldn't create a listenable socket for incoming connections" ;
2091
- LogPrintf (" %s\n " , strError);
2092
- return false ;
2093
- }
2094
-
2095
-
2096
2088
#ifndef WIN32
2097
- #ifdef SO_NOSIGPIPE
2098
- // Different way of disabling SIGPIPE on BSD
2099
- setsockopt (hListenSocket, SOL_SOCKET, SO_NOSIGPIPE, (void *)&nOne, sizeof (int ));
2100
- #endif
2101
2089
// Allow binding if the port is still in TIME_WAIT state after
2102
2090
// the program was closed and restarted.
2103
2091
setsockopt (hListenSocket, SOL_SOCKET, SO_REUSEADDR, (void *)&nOne, sizeof (int ));
2104
- // Disable Nagle's algorithm
2105
- setsockopt (hListenSocket, IPPROTO_TCP, TCP_NODELAY, (void *)&nOne, sizeof (int ));
2106
2092
#else
2107
2093
setsockopt (hListenSocket, SOL_SOCKET, SO_REUSEADDR, (const char *)&nOne, sizeof (int ));
2108
- setsockopt (hListenSocket, IPPROTO_TCP, TCP_NODELAY, (const char *)&nOne, sizeof (int ));
2109
2094
#endif
2110
2095
2111
- // Set to non-blocking, incoming connections will also inherit this
2112
- if (!SetSocketNonBlocking (hListenSocket, true )) {
2113
- CloseSocket (hListenSocket);
2114
- strError = strprintf (" BindListenPort: Setting listening socket to non-blocking failed, error %s\n " , NetworkErrorString (WSAGetLastError ()));
2115
- LogPrintf (" %s\n " , strError);
2116
- return false ;
2117
- }
2118
-
2119
2096
// some systems don't have IPV6_V6ONLY but are always v6only; others do have the option
2120
2097
// and enable it by default or not. Try to enable it, if possible.
2121
2098
if (addrBind.IsIPv6 ()) {
0 commit comments