Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #312 from libp2p/fix/scope-leak
Browse files Browse the repository at this point in the history
release the stream scope if the conn fails to open a new stream
  • Loading branch information
vyzo authored Jan 21, 2022
2 parents 94c0ccf + 4cc6a94 commit 13f96a0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions swarm_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ func (c *Conn) NewStream(ctx context.Context) (network.Stream, error) {
}
ts, err := c.conn.OpenStream(ctx)
if err != nil {
scope.Done()
return nil, err
}
return c.addStream(ts, network.DirOutbound, scope)
Expand Down

0 comments on commit 13f96a0

Please sign in to comment.