@@ -304,7 +304,7 @@ enum class IntrRecvError {
304
304
*
305
305
* @see This function can be interrupted by calling InterruptSocks5(bool).
306
306
* Sockets can be made non-blocking with SetSocketNonBlocking(const
307
- * SOCKET&, bool ).
307
+ * SOCKET&).
308
308
*/
309
309
static IntrRecvError InterruptibleRecv (uint8_t * data, size_t len, int timeout, const Sock& sock)
310
310
{
@@ -517,7 +517,7 @@ std::unique_ptr<Sock> CreateSockTCP(const CService& address_family)
517
517
SetSocketNoDelay (hSocket);
518
518
519
519
// Set the non-blocking option on the socket.
520
- if (!SetSocketNonBlocking (hSocket, true )) {
520
+ if (!SetSocketNonBlocking (hSocket)) {
521
521
CloseSocket (hSocket);
522
522
LogPrintf (" Error setting socket to non-blocking: %s\n " , NetworkErrorString (WSAGetLastError ()));
523
523
return nullptr ;
@@ -716,28 +716,16 @@ bool LookupSubNet(const std::string& strSubnet, CSubNet& ret, DNSLookupFn dns_lo
716
716
return false ;
717
717
}
718
718
719
- bool SetSocketNonBlocking (const SOCKET& hSocket, bool fNonBlocking )
719
+ bool SetSocketNonBlocking (const SOCKET& hSocket)
720
720
{
721
- if (fNonBlocking ) {
722
721
#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) {
725
724
#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) {
728
727
#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 ;
741
729
}
742
730
743
731
return true ;
0 commit comments