aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-08-24 19:19:58 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-08-24 19:19:19 +0200
commitfa82f4ea96749115311cffa0919d49d383c4d28b (patch)
tree05480cf49b6f2f1dde92262a0bc321806673c5bd /src
parenteb09c26724e3f714b613788fc506f2ff3a208d2c (diff)
downloadbitcoin-fa82f4ea96749115311cffa0919d49d383c4d28b.tar.xz
Remove unused MaybeSetAddrName
This logic is a no-op since it was introduced in commit f9f5cfc50637f2cd1540923caf337e2651ec1625. m_addr_name is never initialized to the empty string, because ToStringIPPort never returns an empty string.
Diffstat (limited to 'src')
-rw-r--r--src/net.cpp18
-rw-r--r--src/net.h2
-rw-r--r--src/test/fuzz/net.cpp3
3 files changed, 4 insertions, 19 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 57b8844d6b..51d9c7f590 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -414,14 +414,10 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo
return nullptr;
}
// It is possible that we already have a connection to the IP/port pszDest resolved to.
- // In that case, drop the connection that was just created, and return the existing CNode instead.
- // Also store the name we used to connect in that CNode, so that future FindNode() calls to that
- // name catch this early.
+ // In that case, drop the connection that was just created.
LOCK(cs_vNodes);
CNode* pnode = FindNode(static_cast<CService>(addrConnect));
- if (pnode)
- {
- pnode->MaybeSetAddrName(std::string(pszDest));
+ if (pnode) {
LogPrintf("Failed to open new connection, already connected\n");
return nullptr;
}
@@ -539,14 +535,8 @@ std::string CNode::GetAddrName() const {
return addrName;
}
-void CNode::MaybeSetAddrName(const std::string& addrNameIn) {
- LOCK(cs_addrName);
- if (addrName.empty()) {
- addrName = addrNameIn;
- }
-}
-
-CService CNode::GetAddrLocal() const {
+CService CNode::GetAddrLocal() const
+{
LOCK(cs_addrLocal);
return addrLocal;
}
diff --git a/src/net.h b/src/net.h
index 28cd635976..ee8c1119e7 100644
--- a/src/net.h
+++ b/src/net.h
@@ -659,8 +659,6 @@ public:
}
std::string GetAddrName() const;
- //! Sets the addrName only if it was not previously set
- void MaybeSetAddrName(const std::string& addrNameIn);
std::string ConnectionTypeAsString() const { return ::ConnectionTypeAsString(m_conn_type); }
diff --git a/src/test/fuzz/net.cpp b/src/test/fuzz/net.cpp
index 20d8581312..7b7bde746c 100644
--- a/src/test/fuzz/net.cpp
+++ b/src/test/fuzz/net.cpp
@@ -38,9 +38,6 @@ FUZZ_TARGET_INIT(net, initialize_net)
node.CloseSocketDisconnect();
},
[&] {
- node.MaybeSetAddrName(fuzzed_data_provider.ConsumeRandomLengthString(32));
- },
- [&] {
const std::vector<bool> asmap = ConsumeRandomLengthBitVector(fuzzed_data_provider);
if (!SanityCheckASMap(asmap)) {
return;