Refactor split out of #17167
net: Replace enum CConnMan::NumConnections with enum class ConnectionDirection #19771
pull luke-jr wants to merge 1 commits into bitcoin:master from luke-jr:enum_conndir changing 9 files +36 −24-
luke-jr commented at 7:46 PM on August 20, 2020: member
- DrahtBot added the label GUI on Aug 20, 2020
- DrahtBot added the label Mining on Aug 20, 2020
- DrahtBot added the label P2P on Aug 20, 2020
- DrahtBot added the label RPC/REST/ZMQ on Aug 20, 2020
-
in src/netbase.h:39 in f3aadf86da outdated
30 | + In = (1U << 0), 31 | + Out = (1U << 1), 32 | + Both = (In | Out), 33 | +}; 34 | +static inline ConnectionDirection& operator|=(ConnectionDirection& a, ConnectionDirection b) { 35 | + using underlying = typename std::underlying_type<ConnectionDirection>::type;
promag commented at 10:40 PM on August 20, 2020:Add
#include <type_traits>.
luke-jr commented at 11:43 PM on August 20, 2020:k
in src/netbase.h:40 in f3aadf86da outdated
31 | + Out = (1U << 1), 32 | + Both = (In | Out), 33 | +}; 34 | +static inline ConnectionDirection& operator|=(ConnectionDirection& a, ConnectionDirection b) { 35 | + using underlying = typename std::underlying_type<ConnectionDirection>::type; 36 | + a = ConnectionDirection(underlying(a) | underlying(b));
promag commented at 10:42 PM on August 20, 2020:nit,
return a = ...?
luke-jr commented at 11:43 PM on August 20, 2020:I think it's more readable the current way
luke-jr force-pushed on Aug 20, 2020in src/netbase.h:33 in 8727019ec3 outdated
25 | @@ -25,6 +26,22 @@ static const int DEFAULT_CONNECT_TIMEOUT = 5000; 26 | //! -dns default 27 | static const int DEFAULT_NAME_LOOKUP = true; 28 | 29 | +enum class ConnectionDirection { 30 | + None = 0, 31 | + In = (1U << 0), 32 | + Out = (1U << 1), 33 | + Both = (In | Out),
MarcoFalke commented at 5:38 AM on August 21, 2020:Any reason the new code is not clang formatted?
luke-jr commented at 2:02 PM on September 11, 2020:I don't see any documented way to do that (
contrib/devtools/clang-format-diff.pywants to make a bunch of unrelated changes).Fixed indentation. Anything else?
DrahtBot commented at 5:59 AM on August 21, 2020: contributor<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
No conflicts as of last run.
MarcoFalke removed the label GUI on Aug 21, 2020MarcoFalke removed the label Mining on Aug 21, 2020MarcoFalke removed the label RPC/REST/ZMQ on Aug 21, 2020MarcoFalke added the label Refactoring on Aug 21, 2020DrahtBot cross-referenced this on Aug 21, 2020 from issue Per-Peer Message Capture by troygiorshevDrahtBot cross-referenced this on Aug 21, 2020 from issue rpc, cli: add network in/out connections to `getnetworkinfo` and `-getinfo` by jonatackDrahtBot cross-referenced this on Aug 21, 2020 from issue [tests] Allow outbound & block-relay-only connections in functional tests. by amitiuttarwarDrahtBot cross-referenced this on Aug 21, 2020 from issue qt: Deduplicate NumConnections enum by hebastoDrahtBot cross-referenced this on Aug 21, 2020 from issue p2p: Move all header verification into the network layer, extend logging by troygiorshevDrahtBot cross-referenced this on Aug 21, 2020 from issue bloom: use Span instead of std::vector for `insert` and `contains` [ZAP3] by jb55DrahtBot cross-referenced this on Aug 21, 2020 from issue interfaces: Expose settings.json methods to GUI by ryanofskypracticalswift commented at 6:03 AM on August 23, 2020: contributorConcept ACK:
enum classis strictly betterpromag commented at 10:52 PM on August 23, 2020: memberCode review ACK 8727019ec307badb3bca363cc8bc832aaea4c058, just needs to format correctly apparently.
DrahtBot cross-referenced this on Aug 31, 2020 from issue rpc: remove deprecated CRPCCommand constructor by MarcoFalkeDrahtBot added the label Needs rebase on Sep 4, 2020luke-jr force-pushed on Sep 11, 2020luke-jr requested review from MarcoFalke on Sep 11, 2020luke-jr requested review from promag on Sep 11, 2020DrahtBot removed the label Needs rebase on Sep 11, 2020DrahtBot cross-referenced this on Sep 19, 2020 from issue signet mining utility by ajtownsDrahtBot cross-referenced this on Sep 22, 2020 from issue Assert that RPCArg names are equal to CRPCCommand ones (net, rpcwallet) by MarcoFalkein src/netbase.h:46 in 4ed32388d3 outdated
38 | + return a; 39 | +} 40 | +static inline bool operator&(ConnectionDirection a, ConnectionDirection b) { 41 | + using underlying = typename std::underlying_type<ConnectionDirection>::type; 42 | + return (underlying(a) & underlying(b)); 43 | +}
MarcoFalke commented at 6:18 PM on September 23, 2020:Seems a bit odd to add unused code, but no strong opinion.
jonatack commented at 8:20 PM on March 22, 2021:Seems a bit odd to add unused code, but no strong opinion.
If I understand the comment correctly, this
operator&code is used insrc/net.cpp:2736(at least, currently)if (flags & (pnode->IsInboundConn() ? ConnectionDirection::In : ConnectionDirection::Out)) {MarcoFalke approvedMarcoFalke commented at 6:18 PM on September 23, 2020: memberACK
DrahtBot added the label Needs rebase on Sep 23, 2020luke-jr force-pushed on Oct 30, 2020DrahtBot removed the label Needs rebase on Oct 30, 2020practicalswift commented at 11:01 PM on October 30, 2020: contributorACK 40bc8d725f6542697a0580df0087b230959a3db7: patch looks correct
DrahtBot cross-referenced this on Oct 31, 2020 from issue rpc, net: Expose connections_onion_only in getnetworkinfo RPC output by hebastoDrahtBot cross-referenced this on Nov 11, 2020 from issue Follow-ups to 19107 by troygiorshevDrahtBot cross-referenced this on Nov 25, 2020 from issue refactor: Move node and wallet code out of src/interfaces by ryanofskyDrahtBot cross-referenced this on Nov 25, 2020 from issue multiprocess: Add basic spawn and IPC support by ryanofskyDrahtBot cross-referenced this on Nov 26, 2020 from issue multiprocess: Add bitcoin-gui -ipcconnect option by ryanofskyDrahtBot cross-referenced this on Nov 26, 2020 from issue multiprocess: Add bitcoin-wallet -ipcconnect option by ryanofskyDrahtBot cross-referenced this on Nov 26, 2020 from issue Multiprocess bitcoin by ryanofskyDrahtBot added the label Needs rebase on Dec 1, 2020net: Replace enum CConnMan::NumConnections with enum class ConnectionDirection c77de622ddluke-jr force-pushed on Mar 4, 2021DrahtBot removed the label Needs rebase on Mar 4, 2021practicalswift commented at 7:21 AM on March 6, 2021: contributorcr ACK c77de622dd8ef458f73b1a01a34629a7c4f49358: patch looks correct &
enum classis strictly betterMarcoFalke merged this on Mar 7, 2021MarcoFalke closed this on Mar 7, 2021jonatack cross-referenced this on Mar 22, 2021 from issue p2p, refactor: make NetPermissionFlags an enum class by jonatacklaanwj referenced this in commit 4da26fb85d on May 19, 2021JaredTate cross-referenced this on Oct 30, 2021 from issue WIP: Feature/8.22.0 Random Crash Bug & Missing Dandelion Relay TX Code by JaredTatebitcoin locked this on Aug 16, 2022
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-05-19 06:53 UTC