-
Notifications
You must be signed in to change notification settings - Fork 672
more discriminate connectivity #555
more discriminate connectivity #555
Conversation
Looks good to me, although there is a typo in the commit message... |
a471c0f
to
f9d3b79
Compare
Fixed the typo. And committed a change with a different internal representation for command line supplied addresses. I think it's marginally cleaner and clearer. If you agree I'll happily squash those two commits into one. The last commit is related tidying up in other parts of the code base as a consequence of the 2nd commit. Technically it could be split into two - removal of the NormalisePeerAddr call site and removal of NormalisePeerAddr. The former has no dependency on the other changes. The latter would depend on the lot. |
f9d3b79
to
ba760b4
Compare
ourself *LocalPeer | ||
peers *Peers | ||
port int | ||
targets map[string]*Target |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Yep agree the use of |
If a peer was specified on the command line w/o a port, then do not connect to it if we have inbound connections from that IP. This eliminates unnecessary (and ultimately failing) connection attempts in the common scenario of several peers having been told about each other on their command lines. We represent a command line peer address with a TCPAddr, which avoids back and forth conversion to string and extra fields to carry the "did the original include a port?" information.
There was only one call site left and it always gets invoked with an ip:port, so normalisation is a no-op. Also remove mysterious comment.
ba760b4
to
339f85c
Compare
more discriminate connectivity Closes #478.
If a peer was specified on the command line w/o a port, then do not connect to it if we have inbound connections from that IP.
This eliminates unnecessary (and ultimately failing) connection attempts in the common scenario of several peers having been told about each other on their command lines.
Closes #478.