Page MenuHomePhabricator

Pass MSG_MORE flag when sending non-final network messages
ClosedPublic

Authored by PiRK on Jul 15 2025, 10:50.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCace0ea44f60d: Pass MSG_MORE flag when sending non-final network messages
Summary

Since Nagle's algorithm is disabled, each and every call to send(2) can potentially generate a separate TCP segment on the wire. This is especially inefficient when sending the tiny header preceding each message payload.

Linux implements a MSG_MORE flag that tells the kernel not to push the passed data immediately to the connected peer but rather to collect it in the socket's internal transmit buffer where it can be combined with data from successive calls to send(2). Where available, specify this flag when calling send(2) in CConnman::SocketSendData(CNode &) if the data buffer being sent is not the last one in node.vSendMsg.

MSG_MORE is defined in sys/socket.h which is included in net.cpp via compat.h

This is a backport of core#26844

Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Jul 15 2025, 10:50
src/net.cpp
834 ↗(On Diff #54849)

we lose some of the syntax simplification from D288 with this change.

Alternatively I think we could keep the range-based loop and check for &data != &node.vSendMsg.back(), but i'm not sure which approach is the safest regarding the number of pointer dereferences.

This revision is now accepted and ready to land.Jul 15 2025, 11:46