wip: net: Implement poll #14221

pull pstratem wants to merge 10 commits into bitcoin:master from pstratem:2018-09-11-net-poll changing 2 files +360 −238
  1. pstratem commented at 4:53 PM on September 14, 2018: contributor

    This builds on #14147

    Currently this is failing a test, still investigating why (seems to generally work).

  2. Move DisconnectNodes logic to private method. 2d5c345507
  3. Move InactivityCheck to private method. 71c6341944
  4. Reduce calls to GetMicroTime in InactivityCheck. 8c62109792
  5. Move InactivityChecks logic to private method. 8c2069c4f5
  6. Merge InactivityCheck into InactivityChecks. c27e21b6d4
  7. Run InactivityChecks before other socket handling logic. 8491dfbadc
  8. Move NotifyNumConnectionsChanged logic to private method. e817ce3090
  9. Move SocketHandler logic to private method. 5d3232d2de
  10. Move SocketEvents logic to private method. 54cf6ae777
  11. DrahtBot commented at 6:19 PM on September 14, 2018: member

    <!--e57a25ab6845829454e8d69fc972939a-->Note to reviewers: This pull request conflicts with the following ones:

    • #14335 (net: refactor: cleanup ThreadSocketHandler by pstratem)
    • #14147 (net: Refactor ThreadSocketHandler by pstratem)
    • #14046 (net: Refactor message parsing (CNetMessage), adds flexibility by jonasschnelli)
    • #14032 (Add p2p layer encryption with ECDH/ChaCha20Poly1305 by jonasschnelli)

    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.

  12. Implement poll() on systems which support it properly. 9d5eef9513
  13. pstratem force-pushed on Sep 14, 2018
  14. fanquake added the label P2P on Sep 15, 2018
  15. in src/net.cpp:1272 in 9d5eef9513
    1268 | @@ -1269,6 +1269,7 @@ void CConnman::NotifyNumConnectionsChanged()
    1269 |      }
    1270 |  }
    1271 |  
    1272 | +#ifdef WIN32
    


    ken2812221 commented at 4:52 AM on September 16, 2018:

    IMO you could include this m4 to detect if the system has poll.

  16. in src/net.cpp:1457 in 9d5eef9513
    1582 | +    //
    1583 | +    // Accept new connections
    1584 | +    //
    1585 | +    for (const ListenSocket& hListenSocket : vhListenSocket)
    1586 | +    {
    1587 | +        if (hListenSocket.socket != INVALID_SOCKET && recv_set.count(hListenSocket.socket))
    


    practicalswift commented at 10:02 AM on September 17, 2018:
    2018-09-16 23:09:35 clang-tidy(pr=14221): src/net.cpp:1457:55: warning: implicit conversion 'std::set<unsigned int, std::less<unsigned int>, std::allocator<unsigned int> >::size_type' (aka 'unsigned long') -> bool [readability-implicit-bool-conversion]
    

    Same below. Please fix throughout :-)

  17. in src/net.cpp:1220 in 9d5eef9513
    1272 | +    }
    1273 | +}
    1274 | +
    1275 | +void CConnman::InactivityChecks()
    1276 | +{
    1277 | +    int64_t micro_time, nTime;
    


    practicalswift commented at 10:03 AM on September 17, 2018:
    2018-09-16 23:34:30 cppcheck(pr=14221): [src/net.cpp:1220]: (style) The scope of the variable 'micro_time' can be reduced.
    2018-09-16 23:34:30 cppcheck(pr=14221): [src/net.cpp:1220]: (style) The scope of the variable 'nTime' can be reduced.
    
  18. MarcoFalke closed this on Sep 26, 2018

  19. MarcoFalke locked this on Sep 8, 2021

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-19 00:15 UTC

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