aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-04-17 19:17:40 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-04-17 20:13:34 +0200
commitfaabeb854a6e46b46e4f26b22dc2c81e68e2d863 (patch)
tree89342ff54d5ebfae272d48a613c38d669a454bba /src/net.cpp
parent0dd7b234895b02bfc512ae83bd77b581c861d6e9 (diff)
downloadbitcoin-faabeb854a6e46b46e4f26b22dc2c81e68e2d863.tar.xz
refactor: Mark member functions const
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/net.cpp b/src/net.cpp
index ae38acdc3c..5aa267f0d7 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1732,7 +1732,7 @@ void CConnman::ProcessAddrFetch()
}
}
-bool CConnman::GetTryNewOutboundPeer()
+bool CConnman::GetTryNewOutboundPeer() const
{
return m_try_another_outbound_peer;
}
@@ -1749,7 +1749,7 @@ void CConnman::SetTryNewOutboundPeer(bool flag)
// Also exclude peers that haven't finished initial connection handshake yet
// (so that we don't decide we're over our desired connection limit, and then
// evict some peer that has finished the handshake)
-int CConnman::GetExtraFullOutboundCount()
+int CConnman::GetExtraFullOutboundCount() const
{
int full_outbound_peers = 0;
{
@@ -1763,7 +1763,7 @@ int CConnman::GetExtraFullOutboundCount()
return std::max(full_outbound_peers - m_max_outbound_full_relay, 0);
}
-int CConnman::GetExtraBlockRelayCount()
+int CConnman::GetExtraBlockRelayCount() const
{
int block_relay_peers = 0;
{
@@ -2061,7 +2061,7 @@ std::vector<CAddress> CConnman::GetCurrentBlockRelayOnlyConns() const
return ret;
}
-std::vector<AddedNodeInfo> CConnman::GetAddedNodeInfo()
+std::vector<AddedNodeInfo> CConnman::GetAddedNodeInfo() const
{
std::vector<AddedNodeInfo> ret;
@@ -2671,7 +2671,7 @@ CConnman::~CConnman()
Stop();
}
-std::vector<CAddress> CConnman::GetAddresses(size_t max_addresses, size_t max_pct)
+std::vector<CAddress> CConnman::GetAddresses(size_t max_addresses, size_t max_pct) const
{
std::vector<CAddress> addresses = addrman.GetAddr(max_addresses, max_pct);
if (m_banman) {
@@ -2746,7 +2746,7 @@ bool CConnman::RemoveAddedNode(const std::string& strNode)
return false;
}
-size_t CConnman::GetNodeCount(ConnectionDirection flags)
+size_t CConnman::GetNodeCount(ConnectionDirection flags) const
{
LOCK(cs_vNodes);
if (flags == ConnectionDirection::Both) // Shortcut if we want total
@@ -2762,7 +2762,7 @@ size_t CConnman::GetNodeCount(ConnectionDirection flags)
return nNum;
}
-void CConnman::GetNodeStats(std::vector<CNodeStats>& vstats)
+void CConnman::GetNodeStats(std::vector<CNodeStats>& vstats) const
{
vstats.clear();
LOCK(cs_vNodes);
@@ -2839,18 +2839,18 @@ void CConnman::RecordBytesSent(uint64_t bytes)
nMaxOutboundTotalBytesSentInCycle += bytes;
}
-uint64_t CConnman::GetMaxOutboundTarget()
+uint64_t CConnman::GetMaxOutboundTarget() const
{
LOCK(cs_totalBytesSent);
return nMaxOutboundLimit;
}
-std::chrono::seconds CConnman::GetMaxOutboundTimeframe()
+std::chrono::seconds CConnman::GetMaxOutboundTimeframe() const
{
return MAX_UPLOAD_TIMEFRAME;
}
-std::chrono::seconds CConnman::GetMaxOutboundTimeLeftInCycle()
+std::chrono::seconds CConnman::GetMaxOutboundTimeLeftInCycle() const
{
LOCK(cs_totalBytesSent);
if (nMaxOutboundLimit == 0)
@@ -2864,7 +2864,7 @@ std::chrono::seconds CConnman::GetMaxOutboundTimeLeftInCycle()
return (cycleEndTime < now) ? 0s : cycleEndTime - now;
}
-bool CConnman::OutboundTargetReached(bool historicalBlockServingLimit)
+bool CConnman::OutboundTargetReached(bool historicalBlockServingLimit) const
{
LOCK(cs_totalBytesSent);
if (nMaxOutboundLimit == 0)
@@ -2884,7 +2884,7 @@ bool CConnman::OutboundTargetReached(bool historicalBlockServingLimit)
return false;
}
-uint64_t CConnman::GetOutboundTargetBytesLeft()
+uint64_t CConnman::GetOutboundTargetBytesLeft() const
{
LOCK(cs_totalBytesSent);
if (nMaxOutboundLimit == 0)
@@ -2893,13 +2893,13 @@ uint64_t CConnman::GetOutboundTargetBytesLeft()
return (nMaxOutboundTotalBytesSentInCycle >= nMaxOutboundLimit) ? 0 : nMaxOutboundLimit - nMaxOutboundTotalBytesSentInCycle;
}
-uint64_t CConnman::GetTotalBytesRecv()
+uint64_t CConnman::GetTotalBytesRecv() const
{
LOCK(cs_totalBytesRecv);
return nTotalBytesRecv;
}
-uint64_t CConnman::GetTotalBytesSent()
+uint64_t CConnman::GetTotalBytesSent() const
{
LOCK(cs_totalBytesSent);
return nTotalBytesSent;