net, refactor: Privatise CNode send queue #27407

pull dergoegge wants to merge 8 commits into bitcoin:master from dergoegge:2023-04-cnode-priv-send-🐍 changing 7 files +144 −119
  1. dergoegge commented at 1:36 PM on April 3, 2023: member

    The send queue members on CNode should not be part of the public interface. This PR makes all of them private and creates a clear interface for the send queue.

    The interface after this PR consists of:

    • CNode::PushMessage for appending a message onto the send queue
    • CNode::SocketSendData for pushing as many messages from the send queue as possible onto the wire
    • CNode::IsSendQueueEmpty for checking if the send queue is empty
    • (CNode::TestOnlyClearSendQueue a test-only utility for clearing the send queue)
  2. [net] Store max send buffer size on CNode 32719c9035
  3. [net] Move SocketSendData to CNode
    There are no `CConnman` members used in `SocketSendData`, it should
    therefore be a method in `CNode` instead.
    eee0d86ce1
  4. [net] Move most of CConnman::PushMessage to CNode::PushMessage 7a00bd38d8
  5. [net] Add IsSendQueueEmpty to CNode 96607d126b
  6. [net] Internalize cs_vSend locking to CNode 0922831f3b
  7. [net] Add test only method for clearing CNode send queue 4291d1cc7a
  8. [net] Make CNode send queue members private 66d193c1f4
  9. scripted-diff: [net] Rename CNode send queue members
    -BEGIN VERIFY SCRIPT-
    ren() { sed -i "s:\<$1\>:$2:g" $(git grep -l "\<$1\>" ./src ./test); }
    
    ren cs_vSend    m_send_queue_mutex
    ren vSendMsg    m_send_queue
    ren nSendBytes  m_send_bytes
    ren nSendOffset m_send_offset
    ren nSendSize   m_total_send_size
    
    -END VERIFY SCRIPT-
    a6c811e835
  10. DrahtBot commented at 1:36 PM on April 3, 2023: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #28196 (BIP324 connection support by sipa)
    • #28165 (net: transport abstraction by sipa)
    • #27981 (Fix potential network stalling bug by sipa)
    • #26621 (refactor: Continue moving application data from CNode to Peer by dergoegge)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  11. fanquake requested review from jnewbery on Apr 5, 2023
  12. glozow added the label Refactoring on May 8, 2023
  13. glozow added the label P2P on May 8, 2023
  14. dergoegge closed this on Aug 7, 2023

  15. bitcoin locked this on Aug 6, 2024
Contributors


jnewbery


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-22 06:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me