mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
net: use Sock::SetSockOpt() instead of standalone SetSocketNoDelay()
Since the former is mockable, this makes it easier to test higher level code that sets the TCP_NODELAY flag.
This commit is contained in:
@@ -1190,7 +1190,11 @@ void CConnman::CreateNodeFromAcceptedSocket(std::unique_ptr<Sock>&& sock,
|
||||
|
||||
// According to the internet TCP_NODELAY is not carried into accepted sockets
|
||||
// on all platforms. Set it again here just to be sure.
|
||||
SetSocketNoDelay(sock->Get());
|
||||
const int on{1};
|
||||
if (sock->SetSockOpt(IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) == SOCKET_ERROR) {
|
||||
LogPrint(BCLog::NET, "connection from %s: unable to set TCP_NODELAY, continuing anyway\n",
|
||||
addr.ToString());
|
||||
}
|
||||
|
||||
// Don't accept connections from banned peers.
|
||||
bool banned = m_banman && m_banman->IsBanned(addr);
|
||||
|
||||
Reference in New Issue
Block a user