Skip to content

Commit 13f6dc1

Browse files
committed
merge bitcoin#26844: Pass MSG_MORE flag when sending non-final network messages
1 parent caaa0fd commit 13f6dc1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/net.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,13 @@ size_t CConnman::SocketSendData(CNode& node)
950950
if (!node.m_sock) {
951951
break;
952952
}
953-
nBytes = node.m_sock->Send(reinterpret_cast<const char*>(data.data()) + node.nSendOffset, data.size() - node.nSendOffset, MSG_NOSIGNAL | MSG_DONTWAIT);
953+
int flags = MSG_NOSIGNAL | MSG_DONTWAIT;
954+
#ifdef MSG_MORE
955+
if (it + 1 != node.vSendMsg.end()) {
956+
flags |= MSG_MORE;
957+
}
958+
#endif
959+
nBytes = node.m_sock->Send(reinterpret_cast<const char*>(data.data()) + node.nSendOffset, data.size() - node.nSendOffset, flags);
954960
}
955961
if (nBytes > 0) {
956962
node.m_last_send = GetTime<std::chrono::seconds>();

0 commit comments

Comments
 (0)