Changeset View
Changeset View
Standalone View
Standalone View
src/net.cpp
Show First 20 Lines • Show All 496 Lines • ▼ Show 20 Lines | if (addrLocal.IsValid()) { | ||||
error("Addr local already set for node: %i. Refusing to change from %s " | error("Addr local already set for node: %i. Refusing to change from %s " | ||||
"to %s", | "to %s", | ||||
id, addrLocal.ToString(), addrLocalIn.ToString()); | id, addrLocal.ToString(), addrLocalIn.ToString()); | ||||
} else { | } else { | ||||
addrLocal = addrLocalIn; | addrLocal = addrLocalIn; | ||||
} | } | ||||
} | } | ||||
void CNode::copyStats(CNodeStats &stats) { | void CNode::copyStats(CNodeStats &stats, std::vector<bool> &m_asmap) { | ||||
stats.nodeid = this->GetId(); | stats.nodeid = this->GetId(); | ||||
stats.nServices = nServices; | stats.nServices = nServices; | ||||
stats.addr = addr; | stats.addr = addr; | ||||
stats.addrBind = addrBind; | stats.addrBind = addrBind; | ||||
stats.m_mapped_as = addr.GetMappedAS(m_asmap); | |||||
if (m_tx_relay != nullptr) { | if (m_tx_relay != nullptr) { | ||||
LOCK(m_tx_relay->cs_filter); | LOCK(m_tx_relay->cs_filter); | ||||
stats.fRelayTxes = m_tx_relay->fRelayTxes; | stats.fRelayTxes = m_tx_relay->fRelayTxes; | ||||
} else { | } else { | ||||
stats.fRelayTxes = false; | stats.fRelayTxes = false; | ||||
} | } | ||||
stats.nLastSend = nLastSend; | stats.nLastSend = nLastSend; | ||||
stats.nLastRecv = nLastRecv; | stats.nLastRecv = nLastRecv; | ||||
▲ Show 20 Lines • Show All 2,196 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
void CConnman::GetNodeStats(std::vector<CNodeStats> &vstats) { | void CConnman::GetNodeStats(std::vector<CNodeStats> &vstats) { | ||||
vstats.clear(); | vstats.clear(); | ||||
LOCK(cs_vNodes); | LOCK(cs_vNodes); | ||||
vstats.reserve(vNodes.size()); | vstats.reserve(vNodes.size()); | ||||
for (CNode *pnode : vNodes) { | for (CNode *pnode : vNodes) { | ||||
vstats.emplace_back(); | vstats.emplace_back(); | ||||
pnode->copyStats(vstats.back()); | pnode->copyStats(vstats.back(), addrman.m_asmap); | ||||
} | } | ||||
} | } | ||||
bool CConnman::DisconnectNode(const std::string &strNode) { | bool CConnman::DisconnectNode(const std::string &strNode) { | ||||
LOCK(cs_vNodes); | LOCK(cs_vNodes); | ||||
if (CNode *pnode = FindNode(strNode)) { | if (CNode *pnode = FindNode(strNode)) { | ||||
pnode->fDisconnect = true; | pnode->fDisconnect = true; | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 321 Lines • Show Last 20 Lines |