-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Remove unused MaybeSetAddrName #22782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK fa2d049.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Concept ACK. This was introduced in f9f5cfc, and it looks like it would never work as intended, since the The comment above explains the intention here: |
This logic is a no-op since it was introduced in commit f9f5cfc. m_addr_name is never initialized to the empty string, because ToStringIPPort never returns an empty string.
fa2d049
to
fa973e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK fa973e4
Couple of suggestions for follow-ups.
if (pnode) | ||
{ | ||
pnode->MaybeSetAddrName(std::string(pszDest)); | ||
if (pnode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be simplified further to:
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -415,9 +415,7 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo
}
// 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.
- LOCK(cs_vNodes);
- CNode* pnode = FindNode(static_cast<CService>(addrConnect));
- if (pnode) {
+ if (FindNode(static_cast<CService>(addrConnect)));
LogPrintf("Failed to open new connection, already connected\n");
return nullptr;
}
but probably best left for a future PR. Same for the call to FindNode()
above.
fa973e4
to
fabbe64
Compare
I've force pushed to address a review comment. Happy to revert to the version that had two ACKs, just let me know. |
fabbe64
to
fa9eade
Compare
Code review ACK fa9eade |
utACK fa9eade |
.