Skip to content

Commit a20ab22

Browse files
committed
[net processing] Make GetPeerRef const
1 parent ed7e469 commit a20ab22

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/net_processing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ void PeerManager::FinalizeNode(const CNode& node, bool& fUpdateConnectionTime) {
835835
LogPrint(BCLog::NET, "Cleared nodestate for peer=%d\n", nodeid);
836836
}
837837

838-
PeerRef PeerManager::GetPeerRef(NodeId id)
838+
PeerRef PeerManager::GetPeerRef(NodeId id) const
839839
{
840840
LOCK(m_peer_mutex);
841841
auto it = m_peer_map.find(id);

src/net_processing.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class PeerManager final : public CValidationInterface, public NetEventsInterface
141141
private:
142142
/** Get a shared pointer to the Peer object.
143143
* May return an empty shared_ptr if the Peer object can't be found. */
144-
PeerRef GetPeerRef(NodeId id);
144+
PeerRef GetPeerRef(NodeId id) const;
145145

146146
/**
147147
* Potentially mark a node discouraged based on the contents of a BlockValidationState object
@@ -193,7 +193,7 @@ class PeerManager final : public CValidationInterface, public NetEventsInterface
193193
int64_t m_stale_tip_check_time; //!< Next time to check for stale tip
194194

195195
/** Protects m_peer_map */
196-
Mutex m_peer_mutex;
196+
mutable Mutex m_peer_mutex;
197197
/**
198198
* Map of all Peer objects, keyed by peer id. This map is protected
199199
* by the m_peer_mutex. Once a shared pointer reference is

0 commit comments

Comments
 (0)