Skip to content

Commit 227fee1

Browse files
committed
quic: fix stream limits
1 parent 9fd8ff3 commit 227fee1

2 files changed

Lines changed: 22 additions & 13 deletions

File tree

test/parallel/test-quic-h3-wt-bidi-from-client.mjs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ const serverSessionOpened = Promise.withResolvers();
5353

5454

5555
const serverEndpoint = await listen(mustCall(async (ss) => {
56-
ss.onstream = mustNotCall(async (stream) => {
57-
console.log('Does nothing but is required! Fix me!');
58-
});
5956
ss.onapplication = mustCall((aopts) => {
6057
assert.strictEqual(!aopts.enableDatagrams, false);
6158
});
@@ -91,7 +88,11 @@ const serverEndpoint = await listen(mustCall(async (ss) => {
9188
enableDatagrams: true,
9289
enableWebtransport: true
9390
},
94-
transportParams: { maxDatagramFrameSize: 100 },
91+
transportParams: {
92+
maxDatagramFrameSize: 1000,
93+
initialMaxStreamsBidi: 100, // default value according to spec
94+
initialMaxStreamsUni: 100, // especially important as limit default is 0
95+
},
9596
onheaders: mustCall(function(headers) {
9697
try {
9798
assert.strictEqual(headers[':scheme'], 'https');
@@ -124,7 +125,11 @@ const clientSession = await connect(serverEndpoint.address, {
124125
enableDatagrams: true,
125126
enableWebtransport: true
126127
},
127-
transportParams: { maxDatagramFrameSize: 1000 },
128+
transportParams: {
129+
maxDatagramFrameSize: 1000,
130+
initialMaxStreamsBidi: 100, // default value according to spec
131+
initialMaxStreamsUni: 100, // especially important as limit default is 0
132+
},
128133
});
129134

130135
const webtransportSupport = Promise.withResolvers();

test/parallel/test-quic-h3-wt-unidi-from-client.mjs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ const serverSessionRead = Promise.withResolvers();
5555
const readChunks = [];
5656
let serverSessionStream;
5757
const serverEndpoint = await listen(mustCall(async (ss) => {
58-
ss.onstream = mustNotCall(async (stream) => {
59-
console.log('Does nothing but is required! Fix me!');
60-
});
6158
ss.onapplication = mustCall((aopts) => {
6259
assert.strictEqual(!aopts.enableDatagrams, false);
6360
});
@@ -100,7 +97,11 @@ const serverEndpoint = await listen(mustCall(async (ss) => {
10097
enableDatagrams: true,
10198
enableWebtransport: true
10299
},
103-
transportParams: { maxDatagramFrameSize: 100 },
100+
transportParams: {
101+
maxDatagramFrameSize: 100,
102+
initialMaxStreamsBidi: 100, // default value according to spec
103+
initialMaxStreamsUni: 100, // especially important as limit default is 0
104+
},
104105
onheaders: mustCall(function(headers) {
105106
try {
106107
assert.strictEqual(headers[':scheme'], 'https');
@@ -128,7 +129,11 @@ const clientSession = await connect(serverEndpoint.address, {
128129
enableDatagrams: true,
129130
enableWebtransport: true
130131
},
131-
transportParams: { maxDatagramFrameSize: 1000 },
132+
transportParams: {
133+
maxDatagramFrameSize: 1000,
134+
initialMaxStreamsBidi: 100, // default value according to spec
135+
initialMaxStreamsUni: 100, // especially important as limit default is 0
136+
},
132137
});
133138

134139
const webtransportSupport = Promise.withResolvers();
@@ -156,7 +161,7 @@ clientSession.onstream = mustNotCall((stream) => {
156161
await clientSession.opened;
157162
await webtransportSupport.promise;
158163
// Now we open a webtransport session, which is actually
159-
// a special unidirectional stream
164+
// a special bidirectional stream
160165
const wtSessionStream = await clientSession.createBidirectionalStream({
161166
body: '',
162167
});
@@ -176,7 +181,7 @@ wtSessionStream.sendHeaders({
176181
});
177182

178183
// Well let's get a unidi stream and send something
179-
const clientUnidiStream = await clientSession.createBidirectionalStream({
184+
const clientUnidiStream = await clientSession.createUnidirectionalStream({
180185
incremental: true,
181186
webtransportSession: wtSessionStream // Associate it with the sessionStream
182187
});
@@ -187,7 +192,6 @@ clientUnidiStream.closed.catch((error) => {
187192
// Next step send some data
188193
await serverSessionOpened.promise;
189194

190-
191195
const w = clientUnidiStream.writer;
192196
for (let i = 0; i < numChunks; i++) {
193197
const chunk = buildChunk(i);

0 commit comments

Comments
 (0)