net: only count connections in AddConnection when the type has a limit #35825

pull kwsantiago wants to merge 1 commits into bitcoin:master from privkeyio:net-addconnection-count-guard-core changing 1 files +7 −6
  1. kwsantiago commented at 4:14 PM on July 27, 2026: contributor

    CConnman::AddConnection locks m_nodes_mutex and counts existing connections of the requested type even for types that have no limit (ADDR_FETCH and FEELER), then discards the count. Move the count inside the max_connections != std::nullopt check so we only take the lock and walk the node list when there is a limit to enforce.

    No behavior change: when max_connections is std::nullopt the old code computed a count it never used.

  2. DrahtBot added the label P2P on Jul 27, 2026
  3. DrahtBot commented at 4:15 PM on July 27, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35825.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. net: only count connections in AddConnection when the type has a limit ca7c1456f5
  5. kwsantiago force-pushed on Jul 29, 2026
Contributors
Labels

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-07-31 20:50 UTC

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