Skip to content

Commit

Permalink
webtransport: return error before wrapping opened / accepted streams (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann authored Sep 22, 2022
1 parent 17a342c commit 031ec50
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions p2p/transport/webtransport/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,18 @@ func newConn(tr tpt.Transport, sess *webtransport.Session, sconn *connSecurityMu

func (c *conn) OpenStream(ctx context.Context) (network.MuxedStream, error) {
str, err := c.session.OpenStreamSync(ctx)
return &stream{str}, err
if err != nil {
return nil, err
}
return &stream{str}, nil
}

func (c *conn) AcceptStream() (network.MuxedStream, error) {
str, err := c.session.AcceptStream(context.Background())
return &stream{str}, err
if err != nil {
return nil, err
}
return &stream{str}, nil
}

func (c *conn) Close() error { return c.session.Close() }
Expand Down

0 comments on commit 031ec50

Please sign in to comment.