Browse Source

fix possible panic

pull/456/head
Anton Kaliaev 8 years ago
parent
commit
a63e1bb2dc
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
      switch.go

+ 3
- 3
switch.go View File

@ -549,7 +549,7 @@ func (sw *Switch) AddPeerWithConnection(conn net.Conn, outbound bool) error {
}
if err = sw.AddPeer(peer); err != nil {
peer.CloseConn()
conn.Close()
return err
}
@ -559,12 +559,12 @@ func (sw *Switch) AddPeerWithConnection(conn net.Conn, outbound bool) error {
func (sw *Switch) AddPeerWithConnectionAndConfig(conn net.Conn, outbound bool, config *PeerConfig) error {
peer, err := newPeerFromExistingConnAndConfig(conn, outbound, sw.reactorsByCh, sw.chDescs, sw.StopPeerForError, sw.nodePrivKey, config)
if err != nil {
peer.CloseConn()
conn.Close()
return err
}
if err = sw.AddPeer(peer); err != nil {
peer.CloseConn()
conn.Close()
return err
}


Loading…
Cancel
Save