diff options
author | glozow <gloriajzhao@gmail.com> | 2022-10-12 15:48:35 -0400 |
---|---|---|
committer | glozow <gloriajzhao@gmail.com> | 2022-10-12 15:49:02 -0400 |
commit | 7e1007a3c6c9a921c2b60919b84a60eaabfe1c5d (patch) | |
tree | 90586e6c7e0a88806908a85f1a85b892f09e09b4 /src/net.cpp | |
parent | cc12b8947b6d3f6c4b9cd4d147543dce693c6758 (diff) | |
parent | b527b549504672704a61f70d2565b9489aaaba91 (diff) | |
download | bitcoin-7e1007a3c6c9a921c2b60919b84a60eaabfe1c5d.tar.xz |
Merge bitcoin/bitcoin#25421: net: convert standalone IsSelectableSocket() and SetSocketNonBlocking() to Sock methods
b527b549504672704a61f70d2565b9489aaaba91 net: convert standalone SetSocketNonBlocking() to Sock::SetNonBlocking() (Vasil Dimov)
29f66f76826056f53d971ac734b7ed49b39848d3 moveonly: move SetSocketNonBlocking() from netbase to util/sock (Vasil Dimov)
b4bac556791b5bb8aa118d4c1fed42c3fe45550c net: convert standalone IsSelectableSocket() to Sock::IsSelectable() (Vasil Dimov)
5db7d2ca0aa51ff25f97bf21ce0cbc9e6b741cbd moveonly: move IsSelectableSocket() from compat.h to sock.{h,cpp} (Vasil Dimov)
Pull request description:
_This is a piece of #21878, chopped off to ease review._
* convert standalone `IsSelectableSocket()` to `Sock::IsSelectable()`
* convert standalone `SetSocketNonBlocking()` to `Sock::SetNonBlocking()`
This further encapsulates syscalls inside the `Sock` class and makes the callers mockable.
ACKs for top commit:
jonatack:
ACK b527b549504672704a61f70d2565b9489aaaba91 review/debug build/unit tests at each commit, cross-referenced the changes with `man select` and `man errno`, ran a signet node on the last commit with ip4/ip6//tor/i2p/cjdns and network connections were nominal
dergoegge:
Code review ACK b527b549504672704a61f70d2565b9489aaaba91
Tree-SHA512: af783ce558c7a89e173f7ab323fb3517103d765c19b5d14de29f64706b4e1fea3653492e8ea73ae972699986aaddf2ae72c7cfaa7dad7614254283083b7d2632
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/net.cpp b/src/net.cpp index 0736f3ef1b..3c28b9eddf 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -970,8 +970,7 @@ void CConnman::CreateNodeFromAcceptedSocket(std::unique_ptr<Sock>&& sock, return; } - if (!IsSelectableSocket(sock->Get())) - { + if (!sock->IsSelectable()) { LogPrintf("connection from %s dropped: non-selectable socket\n", addr.ToString()); return; } |