File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -911,13 +911,21 @@ class QUICConnection extends EventTarget {
911
911
// There is one condition where this can happen. That is when both sides of the stream cancel concurrently.
912
912
// Local state is cleaned up while the remote side still sends a closing frame.
913
913
try {
914
+ // Check if the stream can write 0 bytes, should throw if the stream has ended.
915
+ // We need to check if it's writable to trigger any state change for the stream.
914
916
this . conn . streamWritable ( streamId , 0 ) ;
915
- this . logger . debug (
916
- `streamId ${ streamId } was writable without an existing stream` ,
917
+ never (
918
+ 'The stream should never be writable if a QUICStream does not exist for it' ,
917
919
) ;
918
920
} catch ( e ) {
921
+ // Stream should be stopped here, any other error is a never
922
+ if ( e . message . match ( / S t r e a m S t o p p e d \( ( .+ ) \) / ) == null ) {
923
+ // We only expect a StreamStopped error here
924
+ throw e ;
925
+ }
926
+ // If stopped we just ignore it, `streamWritable` should've cleaned up the native state
919
927
this . logger . debug (
920
- `streamId ${ streamId } was writable without an existing stream and error ${ e . message } ` ,
928
+ `StreamId ${ streamId } was writable without an existing stream and error ${ e . message } ` ,
921
929
) ;
922
930
}
923
931
} else {
You can’t perform that action at this time.
0 commit comments