Browse Source

p2p: use conn.Close when peer is nil

pull/1133/head
Ethan Buchman 7 years ago
parent
commit
3090b05eb4
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      p2p/switch.go

+ 1
- 1
p2p/switch.go View File

@ -426,7 +426,7 @@ func (sw *Switch) listenerRoutine(l Listener) {
func (sw *Switch) addInboundPeerWithConfig(conn net.Conn, config *PeerConfig) error {
peer, err := newInboundPeer(conn, sw.reactorsByCh, sw.chDescs, sw.StopPeerForError, sw.nodeKey.PrivKey, config)
if err != nil {
peer.CloseConn()
conn.Close() // peer is nil
return err
}
peer.SetLogger(sw.Logger.With("peer", conn.RemoteAddr()))


Loading…
Cancel
Save