merge bitcoin#26844: Pass MSG_MORE flag when sending non-final network messages

This commit is contained in:
Kittywhiskers Van Gogh 2024-08-06 07:26:00 +00:00
parent caaa0fda01
commit 13f6dc1b27
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD

View File

@ -950,7 +950,13 @@ size_t CConnman::SocketSendData(CNode& node)
if (!node.m_sock) {
break;
}
nBytes = node.m_sock->Send(reinterpret_cast<const char*>(data.data()) + node.nSendOffset, data.size() - node.nSendOffset, MSG_NOSIGNAL | MSG_DONTWAIT);
int flags = MSG_NOSIGNAL | MSG_DONTWAIT;
#ifdef MSG_MORE
if (it + 1 != node.vSendMsg.end()) {
flags |= MSG_MORE;
}
#endif
nBytes = node.m_sock->Send(reinterpret_cast<const char*>(data.data()) + node.nSendOffset, data.size() - node.nSendOffset, flags);
}
if (nBytes > 0) {
node.m_last_send = GetTime<std::chrono::seconds>();