diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/net.cpp | 7 | ||||
-rw-r--r-- | src/net.h | 1 | ||||
-rw-r--r-- | src/net_processing.cpp | 9 |
3 files changed, 13 insertions, 4 deletions
diff --git a/src/net.cpp b/src/net.cpp index 903fedb2fb..f56de6d605 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2614,6 +2614,11 @@ size_t CConnman::GetNodeCount(ConnectionDirection flags) const return nNum; } +uint32_t CConnman::GetMappedAS(const CNetAddr& addr) const +{ + return m_netgroupman.GetMappedAS(addr); +} + void CConnman::GetNodeStats(std::vector<CNodeStats>& vstats) const { vstats.clear(); @@ -2622,7 +2627,7 @@ void CConnman::GetNodeStats(std::vector<CNodeStats>& vstats) const for (CNode* pnode : m_nodes) { vstats.emplace_back(); pnode->CopyStats(vstats.back()); - vstats.back().m_mapped_as = m_netgroupman.GetMappedAS(pnode->addr); + vstats.back().m_mapped_as = GetMappedAS(pnode->addr); } } @@ -851,6 +851,7 @@ public: bool AddConnection(const std::string& address, ConnectionType conn_type) EXCLUSIVE_LOCKS_REQUIRED(!m_unused_i2p_sessions_mutex); size_t GetNodeCount(ConnectionDirection) const; + uint32_t GetMappedAS(const CNetAddr& addr) const; void GetNodeStats(std::vector<CNodeStats>& vstats) const; bool DisconnectNode(const std::string& node); bool DisconnectNode(const CSubNet& subnet); diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 68bd91297c..c9d75c7fbf 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -3362,10 +3362,11 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, if (fLogIPs) remoteAddr = ", peeraddr=" + pfrom.addr.ToStringAddrPort(); - LogPrint(BCLog::NET, "receive version message: %s: version %d, blocks=%d, us=%s, txrelay=%d, peer=%d%s\n", + const auto mapped_as{m_connman.GetMappedAS(pfrom.addr)}; + LogPrint(BCLog::NET, "receive version message: %s: version %d, blocks=%d, us=%s, txrelay=%d, peer=%d%s%s\n", cleanSubVer, pfrom.nVersion, peer->m_starting_height, addrMe.ToStringAddrPort(), fRelay, pfrom.GetId(), - remoteAddr); + remoteAddr, (mapped_as ? strprintf(", mapped_as=%d", mapped_as) : "")); int64_t nTimeOffset = nTime - GetTime(); pfrom.nTimeOffset = nTimeOffset; @@ -3405,9 +3406,11 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, } if (!pfrom.IsInboundConn()) { - LogPrintf("New outbound peer connected: version: %d, blocks=%d, peer=%d%s (%s)\n", + const auto mapped_as{m_connman.GetMappedAS(pfrom.addr)}; + LogPrintf("New outbound peer connected: version: %d, blocks=%d, peer=%d%s%s (%s)\n", pfrom.nVersion.load(), peer->m_starting_height, pfrom.GetId(), (fLogIPs ? strprintf(", peeraddr=%s", pfrom.addr.ToStringAddrPort()) : ""), + (mapped_as ? strprintf(", mapped_as=%d", mapped_as) : ""), pfrom.ConnectionTypeAsString()); } |