get rid of Router.NormalisePeerAddr
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.
This commit is contained in:
1 parent
290d5443cc
commit
339f85cbcb
2 files changed
+2
-14
No files matched your search
@@ -93,10 +93,8 @@ func (peer *LocalPeer) CreateConnection(peerAddr string, acceptNewPeer bool) err
|
|||||||
if err := peer.checkConnectionLimit(); err != nil {
|
if err := peer.checkConnectionLimit(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// We're dialing the remote so that means connections will come from random ports
|
tcpAddr, tcpErr := net.ResolveTCPAddr("tcp4", peerAddr)
|
||||||
addrStr := peer.router.NormalisePeerAddr(peerAddr)
|
udpAddr, udpErr := net.ResolveUDPAddr("udp4", peerAddr)
|
||||||
tcpAddr, tcpErr := net.ResolveTCPAddr("tcp4", addrStr)
|
|
||||||
udpAddr, udpErr := net.ResolveUDPAddr("udp4", addrStr)
|
|
||||||
if tcpErr != nil || udpErr != nil {
|
if tcpErr != nil || udpErr != nil {
|
||||||
// they really should have the same value, but just in case...
|
// they really should have the same value, but just in case...
|
||||||
if tcpErr == nil {
|
if tcpErr == nil {
|
||||||
|
|||||||
@@ -417,13 +417,3 @@ func (router *Router) applyTopologyUpdate(update []byte) (PeerNameSet, PeerNameS
|
|||||||
}
|
}
|
||||||
return origUpdate, newUpdate, nil
|
return origUpdate, newUpdate, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// given an address like '1.2.3.4:567', return the address if it has a port,
|
|
||||||
// otherwise return the address with the default port number for the router
|
|
||||||
func (router *Router) NormalisePeerAddr(peerAddr string) string {
|
|
||||||
_, _, err := net.SplitHostPort(peerAddr)
|
|
||||||
if err == nil {
|
|
||||||
return peerAddr
|
|
||||||
}
|
|
||||||
return fmt.Sprintf("%s:%d", peerAddr, router.Port)
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user