Skip to content

Commit fa78657

Browse files
author
MarcoFalke
committed
Remove unused RecursiveMutex cs_addrName
1 parent fa82f4e commit fa78657

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/net.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -530,9 +530,9 @@ std::string ConnectionTypeAsString(ConnectionType conn_type)
530530
assert(false);
531531
}
532532

533-
std::string CNode::GetAddrName() const {
534-
LOCK(cs_addrName);
535-
return addrName;
533+
std::string CNode::GetAddrName() const
534+
{
535+
return m_addr_name;
536536
}
537537

538538
CService CNode::GetAddrLocal() const
@@ -2956,6 +2956,7 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, SOCKET hSocketIn, const
29562956
: nTimeConnected(GetTimeSeconds()),
29572957
addr(addrIn),
29582958
addrBind(addrBindIn),
2959+
m_addr_name{addrNameIn.empty() ? addr.ToStringIPPort() : addrNameIn},
29592960
m_inbound_onion(inbound_onion),
29602961
nKeyedNetGroup(nKeyedNetGroupIn),
29612962
id(idIn),
@@ -2965,7 +2966,6 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, SOCKET hSocketIn, const
29652966
{
29662967
if (inbound_onion) assert(conn_type_in == ConnectionType::INBOUND);
29672968
hSocket = hSocketIn;
2968-
addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn;
29692969
if (conn_type_in != ConnectionType::BLOCK_RELAY) {
29702970
m_tx_relay = std::make_unique<TxRelay>();
29712971
}
@@ -2975,7 +2975,7 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, SOCKET hSocketIn, const
29752975
mapRecvBytesPerMsgCmd[NET_MESSAGE_COMMAND_OTHER] = 0;
29762976

29772977
if (fLogIPs) {
2978-
LogPrint(BCLog::NET, "Added connection to %s peer=%d\n", addrName, id);
2978+
LogPrint(BCLog::NET, "Added connection to %s peer=%d\n", m_addr_name, id);
29792979
} else {
29802980
LogPrint(BCLog::NET, "Added connection peer=%d\n", id);
29812981
}

src/net.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ class CNode
430430
const CAddress addr;
431431
// Bind address of our side of the connection
432432
const CAddress addrBind;
433+
const std::string m_addr_name;
433434
//! Whether this peer is an inbound onion, i.e. connected via our Tor onion service.
434435
const bool m_inbound_onion;
435436
std::atomic<int> nVersion{0};
@@ -691,10 +692,7 @@ class CNode
691692
//! service advertisements.
692693
const ServiceFlags nLocalServices;
693694

694-
std::list<CNetMessage> vRecvMsg; // Used only by SocketHandler thread
695-
696-
mutable RecursiveMutex cs_addrName;
697-
std::string addrName GUARDED_BY(cs_addrName);
695+
std::list<CNetMessage> vRecvMsg; // Used only by SocketHandler thread
698696

699697
// Our address, as reported by the peer
700698
CService addrLocal GUARDED_BY(cs_addrLocal);

0 commit comments

Comments
 (0)