|
|
@ -321,11 +321,11 @@ func (sw *Switch) DialPeerWithAddress(addr *NetAddress, persistent bool) (*Peer, |
|
|
|
|
|
|
|
sw.Logger.Info("Dialing peer", "address", addr) |
|
|
|
peer, err := newOutboundPeerWithConfig(addr, sw.reactorsByCh, sw.chDescs, sw.StopPeerForError, sw.nodePrivKey, sw.peerConfig) |
|
|
|
peer.SetLogger(sw.Logger.With("peer", addr)) |
|
|
|
if err != nil { |
|
|
|
sw.Logger.Error("Failed to dial peer", "address", addr, "error", err) |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
peer.SetLogger(sw.Logger.With("peer", addr)) |
|
|
|
if persistent { |
|
|
|
peer.makePersistent() |
|
|
|
} |
|
|
@ -548,11 +548,11 @@ func makeSwitch(cfg *cfg.P2PConfig, i int, network, version string, initSwitch f |
|
|
|
|
|
|
|
func (sw *Switch) addPeerWithConnection(conn net.Conn) error { |
|
|
|
peer, err := newInboundPeer(conn, sw.reactorsByCh, sw.chDescs, sw.StopPeerForError, sw.nodePrivKey) |
|
|
|
peer.SetLogger(sw.Logger.With("peer", conn.RemoteAddr())) |
|
|
|
if err != nil { |
|
|
|
conn.Close() |
|
|
|
return err |
|
|
|
} |
|
|
|
peer.SetLogger(sw.Logger.With("peer", conn.RemoteAddr())) |
|
|
|
if err = sw.AddPeer(peer); err != nil { |
|
|
|
conn.Close() |
|
|
|
return err |
|
|
@ -563,11 +563,11 @@ func (sw *Switch) addPeerWithConnection(conn net.Conn) error { |
|
|
|
|
|
|
|
func (sw *Switch) addPeerWithConnectionAndConfig(conn net.Conn, config *PeerConfig) error { |
|
|
|
peer, err := newInboundPeerWithConfig(conn, sw.reactorsByCh, sw.chDescs, sw.StopPeerForError, sw.nodePrivKey, config) |
|
|
|
peer.SetLogger(sw.Logger.With("peer", conn.RemoteAddr())) |
|
|
|
if err != nil { |
|
|
|
conn.Close() |
|
|
|
return err |
|
|
|
} |
|
|
|
peer.SetLogger(sw.Logger.With("peer", conn.RemoteAddr())) |
|
|
|
if err = sw.AddPeer(peer); err != nil { |
|
|
|
conn.Close() |
|
|
|
return err |
|
|
|