Commit 7f810d41 authored by Steven Allen's avatar Steven Allen

fix: reset stream on error

This may have been leaking streams with AutoNAT.
parent a3d48bab
...@@ -152,7 +152,7 @@ func (bh *BlankHost) NewStream(ctx context.Context, p peer.ID, protos ...protoco ...@@ -152,7 +152,7 @@ func (bh *BlankHost) NewStream(ctx context.Context, p peer.ID, protos ...protoco
selected, err := mstream.SelectOneOf(protoStrs, s) selected, err := mstream.SelectOneOf(protoStrs, s)
if err != nil { if err != nil {
s.Close() s.Reset()
return nil, err return nil, err
} }
...@@ -199,7 +199,7 @@ func (bh *BlankHost) newStreamHandler(s network.Stream) { ...@@ -199,7 +199,7 @@ func (bh *BlankHost) newStreamHandler(s network.Stream) {
protoID, handle, err := bh.Mux().Negotiate(s) protoID, handle, err := bh.Mux().Negotiate(s)
if err != nil { if err != nil {
log.Infow("protocol negotiation failed", "error", err) log.Infow("protocol negotiation failed", "error", err)
s.Close() s.Reset()
return return
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment