Skip to content

Commit aa701ae

Browse files
committed
test(http2): the ACK test exercises the peerSettings guard
With a window above 65535 the pre-application already makes the ACK's difference 0, so the test passed without the guard. It now uses a window below 65535, which is not pre-applied, and checks that a further stream WINDOW_UPDATE is fully usable after the ACK (fails without the guard: 66535 sent instead of 131070). Doc on streamWindowSize: batching starts from 2 * 65535, inclusive.
1 parent d94afb5 commit aa701ae

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

‎pkgs/http2/lib/transport.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ abstract class Settings {
7777
/// to this end's receive windows from then on, without waiting for the
7878
/// peer's acknowledgement; a smaller one applies once acknowledged.
7979
///
80-
/// Above 2 * 65535 bytes, received data is acknowledged once per half
80+
/// From 2 * 65535 bytes on, received data is acknowledged once per half
8181
/// window rather than once per DATA frame (also for
8282
/// [connectionWindowSize]).
8383
final int? streamWindowSize;

‎pkgs/http2/test/flow_control_test.dart‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,10 @@ void main() {
258258
expect(received, 100000);
259259
});
260260

261-
test('the ACK of our SETTINGS never grows what we SEND on an open '
262-
'stream: an upload stops at the peer window of 65535 bytes', () async {
263-
await connect(tuned);
261+
test('the ACK of our SETTINGS never changes what we SEND on an open '
262+
'stream; checked with a window below 65535, which is not pre-applied, '
263+
'so the ACK alone carries the change', () async {
264+
await connect(const ClientSettings(streamWindowSize: 1000));
264265
// The peer grants the connection plenty, so only the stream window can
265266
// hold the upload back.
266267
peer
@@ -283,8 +284,16 @@ void main() {
283284
// set off.
284285
await peer.barrier();
285286
await peer.barrier();
286-
287287
expect(sent(), 65535);
288+
289+
// The peer grants the stream another default window: all of it must be
290+
// usable, so the ACK of our own smaller window did not shrink the send
291+
// window.
292+
peer.send(_windowUpdate, 0, 1, [0x00, 0x00, 0xff, 0xff]);
293+
await peer.until(() => sent() > 65535);
294+
await peer.barrier();
295+
await peer.barrier();
296+
expect(sent(), 2 * 65535);
288297
});
289298

290299
test('with large windows, 4 MiB received costs one WINDOW_UPDATE, not two '

0 commit comments

Comments
 (0)