Skip to content

Commit acebb79

Browse files
committed
refactor, move-only: Relocate CNode private members
1 parent 0944024 commit acebb79

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

src/net.h

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -605,41 +605,6 @@ class CNode
605605
CNode(const CNode&) = delete;
606606
CNode& operator=(const CNode&) = delete;
607607

608-
private:
609-
const NodeId id;
610-
const uint64_t nLocalHostNonce;
611-
const ConnectionType m_conn_type;
612-
std::atomic<int> m_greatest_common_version{INIT_PROTO_VERSION};
613-
614-
//! Services offered to this peer.
615-
//!
616-
//! This is supplied by the parent CConnman during peer connection
617-
//! (CConnman::ConnectNode()) from its attribute of the same name.
618-
//!
619-
//! This is const because there is no protocol defined for renegotiating
620-
//! services initially offered to a peer. The set of local services we
621-
//! offer should not change after initialization.
622-
//!
623-
//! An interesting example of this is NODE_NETWORK and initial block
624-
//! download: a node which starts up from scratch doesn't have any blocks
625-
//! to serve, but still advertises NODE_NETWORK because it will eventually
626-
//! fulfill this role after IBD completes. P2P code is written in such a
627-
//! way that it can gracefully handle peers who don't make good on their
628-
//! service advertisements.
629-
const ServiceFlags nLocalServices;
630-
631-
std::list<CNetMessage> vRecvMsg; // Used only by SocketHandler thread
632-
633-
mutable RecursiveMutex cs_addrName;
634-
std::string addrName GUARDED_BY(cs_addrName);
635-
636-
// Our address, as reported by the peer
637-
CService addrLocal GUARDED_BY(cs_addrLocal);
638-
mutable RecursiveMutex cs_addrLocal;
639-
640-
//! Whether this peer is an inbound onion, e.g. connected via our Tor onion service.
641-
const bool m_inbound_onion{false};
642-
643608
public:
644609

645610
NodeId GetId() const {
@@ -760,6 +725,41 @@ class CNode
760725

761726
/** Whether this peer is an inbound onion, e.g. connected via our Tor onion service. */
762727
bool IsInboundOnion() const { return m_inbound_onion; }
728+
729+
private:
730+
const NodeId id;
731+
const uint64_t nLocalHostNonce;
732+
const ConnectionType m_conn_type;
733+
std::atomic<int> m_greatest_common_version{INIT_PROTO_VERSION};
734+
735+
//! Services offered to this peer.
736+
//!
737+
//! This is supplied by the parent CConnman during peer connection
738+
//! (CConnman::ConnectNode()) from its attribute of the same name.
739+
//!
740+
//! This is const because there is no protocol defined for renegotiating
741+
//! services initially offered to a peer. The set of local services we
742+
//! offer should not change after initialization.
743+
//!
744+
//! An interesting example of this is NODE_NETWORK and initial block
745+
//! download: a node which starts up from scratch doesn't have any blocks
746+
//! to serve, but still advertises NODE_NETWORK because it will eventually
747+
//! fulfill this role after IBD completes. P2P code is written in such a
748+
//! way that it can gracefully handle peers who don't make good on their
749+
//! service advertisements.
750+
const ServiceFlags nLocalServices;
751+
752+
std::list<CNetMessage> vRecvMsg; // Used only by SocketHandler thread
753+
754+
mutable RecursiveMutex cs_addrName;
755+
std::string addrName GUARDED_BY(cs_addrName);
756+
757+
// Our address, as reported by the peer
758+
CService addrLocal GUARDED_BY(cs_addrLocal);
759+
mutable RecursiveMutex cs_addrLocal;
760+
761+
//! Whether this peer is an inbound onion, e.g. connected via our Tor onion service.
762+
const bool m_inbound_onion{false};
763763
};
764764

765765
/**

0 commit comments

Comments
 (0)