Browse Source

fix panic: lookup testing on 10.0.2.3:53: no such host

pull/1350/head
Anton Kaliaev 7 years ago
parent
commit
4b8e342309
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      p2p/switch.go

+ 4
- 4
p2p/switch.go View File

@ -58,7 +58,7 @@ type Switch struct {
dialing *cmn.CMap
nodeInfo NodeInfo // our node info
nodeKey *NodeKey // our node privkey
nodePublicAddr *NetAddress
nodePublicAddr string
addrBook AddrBook
filterConnByAddr func(net.Addr) error
@ -149,7 +149,7 @@ func (sw *Switch) IsListening() bool {
// NOTE: Not goroutine safe.
func (sw *Switch) SetNodeInfo(nodeInfo NodeInfo) {
sw.nodeInfo = nodeInfo
sw.nodePublicAddr = nodeInfo.NetAddress()
sw.nodePublicAddr = nodeInfo.ListenAddr
}
// NodeInfo returns the switch's NodeInfo.
@ -384,7 +384,7 @@ func (sw *Switch) DialPeersAsync(addrBook AddrBook, peers []string, persistent b
// If `persistent == true`, the switch will always try to reconnect to this peer if the connection ever fails.
func (sw *Switch) DialPeerWithAddress(addr *NetAddress, persistent bool) error {
// do not dial ourselves
if addr.Same(sw.nodePublicAddr) {
if addr.DialString() == sw.nodePublicAddr {
return ErrSwitchConnectToSelf
}
@ -531,7 +531,7 @@ func (sw *Switch) addPeer(pc peerConn) error {
if sw.nodeKey.ID() == peerID {
// overwrite current addr to avoid dialing ourselves again
// it means original nodePublicAddr was different from public one
sw.nodePublicAddr = peerNodeInfo.NetAddress()
sw.nodePublicAddr = peerNodeInfo.ListenAddr
return ErrSwitchConnectToSelf
}


Loading…
Cancel
Save