@@ -372,36 +372,46 @@ func TestLostMaxStreamsFrameMostRecent(t *testing.T) {
372
372
// "[...] an updated value is sent when a packet containing the
373
373
// most recent MAX_STREAMS for a stream type frame is declared lost [...]"
374
374
// https://www.rfc-editor.org/rfc/rfc9000#section-13.3-3.9
375
- lostFrameTest (t , func (t * testing.T , pto bool ) {
376
- ctx := canceledContext ()
377
- tc := newTestConn (t , serverSide , func (c * Config ) {
378
- c .MaxUniRemoteStreams = 1
379
- })
380
- tc .handshake ()
381
- tc .ignoreFrame (frameTypeAck )
382
- tc .writeFrames (packetType1RTT , debugFrameStream {
383
- id : newStreamID (clientSide , uniStream , 0 ),
384
- fin : true ,
375
+ testStreamTypes (t , "" , func (t * testing.T , styp streamType ) {
376
+ lostFrameTest (t , func (t * testing.T , pto bool ) {
377
+ ctx := canceledContext ()
378
+ tc := newTestConn (t , serverSide , func (c * Config ) {
379
+ c .MaxUniRemoteStreams = 1
380
+ c .MaxBidiRemoteStreams = 1
381
+ })
382
+ tc .handshake ()
383
+ tc .ignoreFrame (frameTypeAck )
384
+ tc .writeFrames (packetType1RTT , debugFrameStream {
385
+ id : newStreamID (clientSide , styp , 0 ),
386
+ fin : true ,
387
+ })
388
+ s , err := tc .conn .AcceptStream (ctx )
389
+ if err != nil {
390
+ t .Fatalf ("AcceptStream() = %v" , err )
391
+ }
392
+ s .CloseContext (ctx )
393
+ if styp == bidiStream {
394
+ tc .wantFrame ("stream is closed" ,
395
+ packetType1RTT , debugFrameStream {
396
+ id : s .id ,
397
+ data : []byte {},
398
+ fin : true ,
399
+ })
400
+ tc .writeAckForAll ()
401
+ }
402
+ tc .wantFrame ("closing stream updates peer's MAX_STREAMS" ,
403
+ packetType1RTT , debugFrameMaxStreams {
404
+ streamType : styp ,
405
+ max : 2 ,
406
+ })
407
+
408
+ tc .triggerLossOrPTO (packetType1RTT , pto )
409
+ tc .wantFrame ("lost MAX_STREAMS is resent" ,
410
+ packetType1RTT , debugFrameMaxStreams {
411
+ streamType : styp ,
412
+ max : 2 ,
413
+ })
385
414
})
386
- s , err := tc .conn .AcceptStream (ctx )
387
- if err != nil {
388
- t .Fatalf ("AcceptStream() = %v" , err )
389
- }
390
- if err := s .CloseContext (ctx ); err != nil {
391
- t .Fatalf ("stream.Close() = %v" , err )
392
- }
393
- tc .wantFrame ("closing stream updates peer's MAX_STREAMS" ,
394
- packetType1RTT , debugFrameMaxStreams {
395
- streamType : uniStream ,
396
- max : 2 ,
397
- })
398
-
399
- tc .triggerLossOrPTO (packetType1RTT , pto )
400
- tc .wantFrame ("lost MAX_STREAMS is resent" ,
401
- packetType1RTT , debugFrameMaxStreams {
402
- streamType : uniStream ,
403
- max : 2 ,
404
- })
405
415
})
406
416
}
407
417
0 commit comments