mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
refactor: Mark member functions const
This commit is contained in:
parent
0dd7b23489
commit
faabeb854a
4 changed files with 34 additions and 34 deletions
28
src/net.cpp
28
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue