p2p/net/swarm: fixed bugs in swarm err closes
Juan Batiz-Benet committed
Jan 13, 2015 at 02:37 UTC
e3eaa154af515f036609203afccdfaabed9a585c
1 file changed
+2
-2
p2p/net/swarm/swarm_dial.go
+2
-2
@@ -185,7 +185,7 @@ func (s *Swarm) dial(ctx context.Context, p peer.ID) (*Conn, error) {
185
if err != nil {
186
log.Error("Dial newConnSetup failed. disconnecting.")
187
log.Event(ctx, "dialFailureDisconnect", lgbl.NetConn(connC), lgbl.Error(err))
188
- swarmC.Close() // close the connection. didn't work out :(
188
+ connC.Close() // close the connection. didn't work out :(
189
return nil, err
190
}
191
@@ -241,7 +241,7 @@ func dialConnSetup(ctx context.Context, s *Swarm, connC conn.Conn) (*Conn, error
241
if err != nil {
242
log.Error("Dial newConnSetup failed. disconnecting.")
243
log.Event(ctx, "dialFailureDisconnect", lgbl.NetConn(connC), lgbl.Error(err))
244
- swarmC.Close() // we need to call this to make sure psC is Closed.
244
+ psC.Close() // we need to make sure psC is Closed.
245
return nil, err
246
}
247