From e3eaa154af515f036609203afccdfaabed9a585c Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Tue, 13 Jan 2015 02:37:26 -0800 Subject: [PATCH] p2p/net/swarm: fixed bugs in swarm err closes --- p2p/net/swarm/swarm_dial.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/p2p/net/swarm/swarm_dial.go b/p2p/net/swarm/swarm_dial.go index 4d118f84c..9cc4bd653 100644 --- a/p2p/net/swarm/swarm_dial.go +++ b/p2p/net/swarm/swarm_dial.go @@ -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 }