1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-26 15:42:21 +08:00

p2p/net/swarm: fixed bugs in swarm err closes

This commit is contained in:
Juan Batiz-Benet
2015-01-13 02:37:26 -08:00
parent 9b2ccf1e17
commit e3eaa154af

View File

@ -185,7 +185,7 @@ func (s *Swarm) dial(ctx context.Context, p peer.ID) (*Conn, error) {
if err != nil {
log.Error("Dial newConnSetup failed. disconnecting.")
log.Event(ctx, "dialFailureDisconnect", lgbl.NetConn(connC), lgbl.Error(err))
swarmC.Close() // close the connection. didn't work out :(
connC.Close() // close the connection. didn't work out :(
return nil, err
}
@ -241,7 +241,7 @@ func dialConnSetup(ctx context.Context, s *Swarm, connC conn.Conn) (*Conn, error
if err != nil {
log.Error("Dial newConnSetup failed. disconnecting.")
log.Event(ctx, "dialFailureDisconnect", lgbl.NetConn(connC), lgbl.Error(err))
swarmC.Close() // we need to call this to make sure psC is Closed.
psC.Close() // we need to make sure psC is Closed.
return nil, err
}