Skip to content

Commit

Permalink
Remove GetAddrName
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke committed Aug 26, 2021
1 parent fa78657 commit fa9eade
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 19 deletions.
2 changes: 1 addition & 1 deletion doc/tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ For example:
```C++
TRACE6(net, inbound_message,
pnode->GetId(),
pnode->GetAddrName().c_str(),
pnode->m_addr_name.c_str(),
pnode->ConnectionTypeAsString().c_str(),
sanitizedType.c_str(),
msg.data.size(),
Expand Down
13 changes: 4 additions & 9 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ CNode* CConnman::FindNode(const std::string& addrName)
{
LOCK(cs_vNodes);
for (CNode* pnode : vNodes) {
if (pnode->GetAddrName() == addrName) {
if (pnode->m_addr_name == addrName) {
return pnode;
}
}
Expand Down Expand Up @@ -530,11 +530,6 @@ std::string ConnectionTypeAsString(ConnectionType conn_type)
assert(false);
}

std::string CNode::GetAddrName() const
{
return m_addr_name;
}

CService CNode::GetAddrLocal() const
{
LOCK(cs_addrLocal);
Expand Down Expand Up @@ -577,7 +572,7 @@ void CNode::copyStats(CNodeStats &stats, const std::vector<bool> &m_asmap)
X(nLastBlockTime);
X(nTimeConnected);
X(nTimeOffset);
stats.addrName = GetAddrName();
X(m_addr_name);
X(nVersion);
{
LOCK(cs_SubVer);
Expand Down Expand Up @@ -2127,7 +2122,7 @@ std::vector<AddedNodeInfo> CConnman::GetAddedNodeInfo() const
if (pnode->addr.IsValid()) {
mapConnected[pnode->addr] = pnode->IsInboundConn();
}
std::string addrName = pnode->GetAddrName();
std::string addrName{pnode->m_addr_name};
if (!addrName.empty()) {
mapConnectedByName[std::move(addrName)] = std::make_pair(pnode->IsInboundConn(), static_cast<const CService&>(pnode->addr));
}
Expand Down Expand Up @@ -3004,7 +2999,7 @@ void CConnman::PushMessage(CNode* pnode, CSerializedNetMsg&& msg)

TRACE6(net, outbound_message,
pnode->GetId(),
pnode->GetAddrName().c_str(),
pnode->m_addr_name.c_str(),
pnode->ConnectionTypeAsString().c_str(),
msg.m_type.c_str(),
msg.data.size(),
Expand Down
4 changes: 1 addition & 3 deletions src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class CNodeStats
int64_t nLastBlockTime;
int64_t nTimeConnected;
int64_t nTimeOffset;
std::string addrName;
std::string m_addr_name;
int nVersion;
std::string cleanSubVer;
bool fInbound;
Expand Down Expand Up @@ -659,8 +659,6 @@ class CNode
return nLocalServices;
}

std::string GetAddrName() const;

std::string ConnectionTypeAsString() const { return ::ConnectionTypeAsString(m_conn_type); }

/** A ping-pong round trip has completed successfully. Update latest and minimum ping times. */
Expand Down
2 changes: 1 addition & 1 deletion src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4086,7 +4086,7 @@ bool PeerManagerImpl::ProcessMessages(CNode* pfrom, std::atomic<bool>& interrupt

TRACE6(net, inbound_message,
pfrom->GetId(),
pfrom->GetAddrName().c_str(),
pfrom->m_addr_name.c_str(),
pfrom->ConnectionTypeAsString().c_str(),
msg.m_command.c_str(),
msg.m_recv.size(),
Expand Down
2 changes: 1 addition & 1 deletion src/qt/peertablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ QVariant PeerTableModel::data(const QModelIndex& index, int role) const
case NetNodeId:
return (qint64)rec->nodeStats.nodeid;
case Address:
return QString::fromStdString(rec->nodeStats.addrName);
return QString::fromStdString(rec->nodeStats.m_addr_name);
case Direction:
return QString(rec->nodeStats.fInbound ?
//: An Inbound Connection from a Peer.
Expand Down
2 changes: 1 addition & 1 deletion src/qt/peertablesortproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ bool PeerTableSortProxy::lessThan(const QModelIndex& left_index, const QModelInd
case PeerTableModel::NetNodeId:
return left_stats.nodeid < right_stats.nodeid;
case PeerTableModel::Address:
return left_stats.addrName.compare(right_stats.addrName) < 0;
return left_stats.m_addr_name.compare(right_stats.m_addr_name) < 0;
case PeerTableModel::Direction:
return left_stats.fInbound > right_stats.fInbound; // default sort Inbound, then Outbound
case PeerTableModel::ConnectionType:
Expand Down
2 changes: 1 addition & 1 deletion src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ void RPCConsole::updateDetailWidget()
}
const auto stats = selected_peers.first().data(PeerTableModel::StatsRole).value<CNodeCombinedStats*>();
// update the detail ui with latest node information
QString peerAddrDetails(QString::fromStdString(stats->nodeStats.addrName) + " ");
QString peerAddrDetails(QString::fromStdString(stats->nodeStats.m_addr_name) + " ");
peerAddrDetails += tr("(peer: %1)").arg(QString::number(stats->nodeStats.nodeid));
if (!stats->nodeStats.addrLocal.empty())
peerAddrDetails += "<br />" + tr("via %1").arg(QString::fromStdString(stats->nodeStats.addrLocal));
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static RPCHelpMan getpeerinfo()
CNodeStateStats statestats;
bool fStateStats = peerman.GetNodeStateStats(stats.nodeid, statestats);
obj.pushKV("id", stats.nodeid);
obj.pushKV("addr", stats.addrName);
obj.pushKV("addr", stats.m_addr_name);
if (stats.addrBind.IsValid()) {
obj.pushKV("addrbind", stats.addrBind.ToString());
}
Expand Down
1 change: 0 additions & 1 deletion src/test/fuzz/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ FUZZ_TARGET_INIT(net, initialize_net)
}

(void)node.GetAddrLocal();
(void)node.GetAddrName();
(void)node.GetId();
(void)node.GetLocalNonce();
(void)node.GetLocalServices();
Expand Down

0 comments on commit fa9eade

Please sign in to comment.