@@ -288,8 +288,7 @@ enum class IntrRecvError {
288288 * read.
289289 *
290290 * @see This function can be interrupted by calling InterruptSocks5(bool).
291- * Sockets can be made non-blocking with SetSocketNonBlocking(const
292- * SOCKET&).
291+ * Sockets can be made non-blocking with Sock::SetNonBlocking().
293292 */
294293static IntrRecvError InterruptibleRecv (uint8_t * data, size_t len, int timeout, const Sock& sock)
295294{
@@ -487,7 +486,7 @@ std::unique_ptr<Sock> CreateSockTCP(const CService& address_family)
487486
488487 // Ensure that waiting for I/O on this socket won't result in undefined
489488 // behavior.
490- if (!IsSelectableSocket ( sock->Get () )) {
489+ if (!sock->IsSelectable ( )) {
491490 LogPrintf (" Cannot create connection: non-selectable socket created (fd >= FD_SETSIZE ?)\n " );
492491 return nullptr ;
493492 }
@@ -509,7 +508,7 @@ std::unique_ptr<Sock> CreateSockTCP(const CService& address_family)
509508 }
510509
511510 // Set the non-blocking option on the socket.
512- if (!SetSocketNonBlocking ( sock->Get () )) {
511+ if (!sock->SetNonBlocking ( )) {
513512 LogPrintf (" Error setting socket to non-blocking: %s\n " , NetworkErrorString (WSAGetLastError ()));
514513 return nullptr ;
515514 }
@@ -701,21 +700,6 @@ bool LookupSubNet(const std::string& subnet_str, CSubNet& subnet_out)
701700 return false ;
702701}
703702
704- bool SetSocketNonBlocking (const SOCKET& hSocket)
705- {
706- #ifdef WIN32
707- u_long nOne = 1 ;
708- if (ioctlsocket (hSocket, FIONBIO, &nOne) == SOCKET_ERROR) {
709- #else
710- int fFlags = fcntl (hSocket, F_GETFL, 0 );
711- if (fcntl (hSocket, F_SETFL, fFlags | O_NONBLOCK) == SOCKET_ERROR) {
712- #endif
713- return false ;
714- }
715-
716- return true ;
717- }
718-
719703void InterruptSocks5 (bool interrupt)
720704{
721705 interruptSocks5Recv = interrupt;
0 commit comments