@@ -304,7 +304,7 @@ enum class IntrRecvError {
304304 *
305305 * @see This function can be interrupted by calling InterruptSocks5(bool).
306306 * Sockets can be made non-blocking with SetSocketNonBlocking(const
307- * SOCKET&, bool ).
307+ * SOCKET&).
308308 */
309309static IntrRecvError InterruptibleRecv (uint8_t * data, size_t len, int timeout, const Sock& sock)
310310{
@@ -517,7 +517,7 @@ std::unique_ptr<Sock> CreateSockTCP(const CService& address_family)
517517 SetSocketNoDelay (hSocket);
518518
519519 // Set the non-blocking option on the socket.
520- if (!SetSocketNonBlocking (hSocket, true )) {
520+ if (!SetSocketNonBlocking (hSocket)) {
521521 CloseSocket (hSocket);
522522 LogPrintf (" Error setting socket to non-blocking: %s\n " , NetworkErrorString (WSAGetLastError ()));
523523 return nullptr ;
@@ -716,28 +716,16 @@ bool LookupSubNet(const std::string& strSubnet, CSubNet& ret, DNSLookupFn dns_lo
716716 return false ;
717717}
718718
719- bool SetSocketNonBlocking (const SOCKET& hSocket, bool fNonBlocking )
719+ bool SetSocketNonBlocking (const SOCKET& hSocket)
720720{
721- if (fNonBlocking ) {
722721#ifdef WIN32
723- u_long nOne = 1 ;
724- if (ioctlsocket (hSocket, FIONBIO, &nOne) == SOCKET_ERROR) {
722+ u_long nOne = 1 ;
723+ if (ioctlsocket (hSocket, FIONBIO, &nOne) == SOCKET_ERROR) {
725724#else
726- int fFlags = fcntl (hSocket, F_GETFL, 0 );
727- if (fcntl (hSocket, F_SETFL, fFlags | O_NONBLOCK) == SOCKET_ERROR) {
725+ int fFlags = fcntl (hSocket, F_GETFL, 0 );
726+ if (fcntl (hSocket, F_SETFL, fFlags | O_NONBLOCK) == SOCKET_ERROR) {
728727#endif
729- return false ;
730- }
731- } else {
732- #ifdef WIN32
733- u_long nZero = 0 ;
734- if (ioctlsocket (hSocket, FIONBIO, &nZero) == SOCKET_ERROR) {
735- #else
736- int fFlags = fcntl (hSocket, F_GETFL, 0 );
737- if (fcntl (hSocket, F_SETFL, fFlags & ~O_NONBLOCK) == SOCKET_ERROR) {
738- #endif
739- return false ;
740- }
728+ return false ;
741729 }
742730
743731 return true ;
0 commit comments