mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 06:52:36 +01:00
Remove unused MaybeSetAddrName
This logic is a no-op since it was introduced in commit
f9f5cfc506
.
m_addr_name is never initialized to the empty string, because
ToStringIPPort never returns an empty string.
This commit is contained in:
parent
eb09c26724
commit
fa82f4ea96
3 changed files with 4 additions and 19 deletions
18
src/net.cpp
18
src/net.cpp
|
@ -414,14 +414,10 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
// It is possible that we already have a connection to the IP/port pszDest resolved to.
|
// 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.
|
// In that case, drop the connection that was just created.
|
||||||
// Also store the name we used to connect in that CNode, so that future FindNode() calls to that
|
|
||||||
// name catch this early.
|
|
||||||
LOCK(cs_vNodes);
|
LOCK(cs_vNodes);
|
||||||
CNode* pnode = FindNode(static_cast<CService>(addrConnect));
|
CNode* pnode = FindNode(static_cast<CService>(addrConnect));
|
||||||
if (pnode)
|
if (pnode) {
|
||||||
{
|
|
||||||
pnode->MaybeSetAddrName(std::string(pszDest));
|
|
||||||
LogPrintf("Failed to open new connection, already connected\n");
|
LogPrintf("Failed to open new connection, already connected\n");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -539,14 +535,8 @@ std::string CNode::GetAddrName() const {
|
||||||
return addrName;
|
return addrName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNode::MaybeSetAddrName(const std::string& addrNameIn) {
|
CService CNode::GetAddrLocal() const
|
||||||
LOCK(cs_addrName);
|
{
|
||||||
if (addrName.empty()) {
|
|
||||||
addrName = addrNameIn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CService CNode::GetAddrLocal() const {
|
|
||||||
LOCK(cs_addrLocal);
|
LOCK(cs_addrLocal);
|
||||||
return addrLocal;
|
return addrLocal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -659,8 +659,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetAddrName() const;
|
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); }
|
std::string ConnectionTypeAsString() const { return ::ConnectionTypeAsString(m_conn_type); }
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,6 @@ FUZZ_TARGET_INIT(net, initialize_net)
|
||||||
[&] {
|
[&] {
|
||||||
node.CloseSocketDisconnect();
|
node.CloseSocketDisconnect();
|
||||||
},
|
},
|
||||||
[&] {
|
|
||||||
node.MaybeSetAddrName(fuzzed_data_provider.ConsumeRandomLengthString(32));
|
|
||||||
},
|
|
||||||
[&] {
|
[&] {
|
||||||
const std::vector<bool> asmap = ConsumeRandomLengthBitVector(fuzzed_data_provider);
|
const std::vector<bool> asmap = ConsumeRandomLengthBitVector(fuzzed_data_provider);
|
||||||
if (!SanityCheckASMap(asmap)) {
|
if (!SanityCheckASMap(asmap)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue