Browse Source

move SetLogger down

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

+ 3
- 3
p2p/switch.go View File

@ -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


Loading…
Cancel
Save