Skip to content

Commit

Permalink
dan comment
Browse files Browse the repository at this point in the history
  • Loading branch information
benjirewis committed Nov 20, 2024
1 parent 3e5b472 commit f7adf64
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rpc/wrtc_client_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ func newWebRTCClientStream(
// Assume that cancelation of the client channel's context means the peer
// connection and base channel have both closed, and the client is
// disconnected.
//
// We could rely on eventual reads/writes from/to the stream failing with a
// `io.ErrClosedPipe`, but not checking the channel's context here will mean
// we can create a stream _while_ the channel is closing/closed, which can
// result in data races and undefined behavior.
if channel.ctx.Err() != nil {
return nil, ErrDisconnected
}
Expand Down

0 comments on commit f7adf64

Please sign in to comment.