mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 06:52:36 +01:00
[net] Remove trivial GetConnectionType() getter
This commit is contained in:
parent
b5a85b365a
commit
860402ef2e
2 changed files with 5 additions and 9 deletions
|
@ -917,7 +917,7 @@ bool CConnman::AttemptToEvictConnection()
|
|||
.m_is_local = node->addr.IsLocal(),
|
||||
.m_network = node->ConnectedThroughNetwork(),
|
||||
.m_noban = node->HasPermission(NetPermissionFlags::NoBan),
|
||||
.m_conn_type = node->GetConnectionType(),
|
||||
.m_conn_type = node->m_conn_type,
|
||||
};
|
||||
vEvictionCandidates.push_back(candidate);
|
||||
}
|
||||
|
@ -1092,7 +1092,7 @@ bool CConnman::AddConnection(const std::string& address, ConnectionType conn_typ
|
|||
|
||||
// Count existing connections
|
||||
int existing_connections = WITH_LOCK(m_nodes_mutex,
|
||||
return std::count_if(m_nodes.begin(), m_nodes.end(), [conn_type](CNode* node) { return node->GetConnectionType() == conn_type; }););
|
||||
return std::count_if(m_nodes.begin(), m_nodes.end(), [conn_type](CNode* node) { return node->m_conn_type == conn_type; }););
|
||||
|
||||
// Max connections of specified type already exist
|
||||
if (max_connections != std::nullopt && existing_connections >= max_connections) return false;
|
||||
|
@ -1711,7 +1711,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)
|
|||
if (pnode->IsBlockOnlyConn()) nOutboundBlockRelay++;
|
||||
|
||||
// Make sure our persistent outbound slots belong to different netgroups.
|
||||
switch (pnode->GetConnectionType()) {
|
||||
switch (pnode->m_conn_type) {
|
||||
// We currently don't take inbound connections into account. Since they are
|
||||
// free to make, an attacker could make them to prevent us from connecting to
|
||||
// certain peers.
|
||||
|
@ -2777,9 +2777,9 @@ CNode::CNode(NodeId idIn,
|
|||
m_inbound_onion{inbound_onion},
|
||||
m_prefer_evict{node_opts.prefer_evict},
|
||||
nKeyedNetGroup{nKeyedNetGroupIn},
|
||||
m_conn_type{conn_type_in},
|
||||
id{idIn},
|
||||
nLocalHostNonce{nLocalHostNonceIn},
|
||||
m_conn_type{conn_type_in},
|
||||
m_i2p_sam_session{std::move(node_opts.i2p_sam_session)}
|
||||
{
|
||||
if (inbound_onion) assert(conn_type_in == ConnectionType::INBOUND);
|
||||
|
|
|
@ -418,10 +418,7 @@ public:
|
|||
std::atomic_bool fPauseRecv{false};
|
||||
std::atomic_bool fPauseSend{false};
|
||||
|
||||
const ConnectionType& GetConnectionType() const
|
||||
{
|
||||
return m_conn_type;
|
||||
}
|
||||
const ConnectionType m_conn_type;
|
||||
|
||||
/** Move all messages from the received queue to the processing queue. */
|
||||
void MarkReceivedMsgsForProcessing(unsigned int recv_flood_size)
|
||||
|
@ -622,7 +619,6 @@ public:
|
|||
private:
|
||||
const NodeId id;
|
||||
const uint64_t nLocalHostNonce;
|
||||
const ConnectionType m_conn_type;
|
||||
std::atomic<int> m_greatest_common_version{INIT_PROTO_VERSION};
|
||||
|
||||
std::list<CNetMessage> vRecvMsg; // Used only by SocketHandler thread
|
||||
|
|
Loading…
Add table
Reference in a new issue