aboutsummaryrefslogtreecommitdiff
path: root/src/netbase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/netbase.cpp')
-rw-r--r--src/netbase.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp
index 0860851678..9557297df1 100644
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -519,7 +519,10 @@ std::unique_ptr<Sock> CreateSockTCP(const CService& address_family)
#endif
// Set the no-delay option (disable Nagle's algorithm) on the TCP socket.
- SetSocketNoDelay(sock->Get());
+ const int on{1};
+ if (sock->SetSockOpt(IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) == SOCKET_ERROR) {
+ LogPrint(BCLog::NET, "Unable to set TCP_NODELAY on a newly created socket, continuing anyway\n");
+ }
// Set the non-blocking option on the socket.
if (!SetSocketNonBlocking(sock->Get())) {
@@ -729,13 +732,6 @@ bool SetSocketNonBlocking(const SOCKET& hSocket)
return true;
}
-bool SetSocketNoDelay(const SOCKET& hSocket)
-{
- int set = 1;
- int rc = setsockopt(hSocket, IPPROTO_TCP, TCP_NODELAY, (const char*)&set, sizeof(int));
- return rc == 0;
-}
-
void InterruptSocks5(bool interrupt)
{
interruptSocks5Recv = interrupt;