Skip to content

Commit 5401f76

Browse files
committed
quic: test lost bidi MAX_STREAMS frame handling
Test a previously untested path in lost frame handling. For golang/go#58547 Change-Id: I2a6fab795aa76db15b511bc48b9c14cd549626dd Reviewed-on: https://go-review.googlesource.com/c/net/+/526715 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Jonathan Amsterdam <[email protected]>
1 parent da5f9f7 commit 5401f76

File tree

1 file changed

+39
-29
lines changed

1 file changed

+39
-29
lines changed

internal/quic/conn_loss_test.go

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -372,36 +372,46 @@ func TestLostMaxStreamsFrameMostRecent(t *testing.T) {
372372
// "[...] an updated value is sent when a packet containing the
373373
// most recent MAX_STREAMS for a stream type frame is declared lost [...]"
374374
// 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+
})
385414
})
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-
})
405415
})
406416
}
407417

0 commit comments

Comments
 (0)