Skip to content

Commit ed88355

Browse files
committed
quic: use opened instead ready for QuicStream
1 parent 73e837f commit ed88355

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

‎doc/api/quic.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1921,7 +1921,7 @@ Either `'application'` or `'transport'`. Indicates the namespace of
19211921
added: v23.8.0
19221922
-->
19231923

1924-
### `stream.ready`
1924+
### `stream.open`
19251925

19261926
<!-- YAML
19271927
added: REPLACEME

‎lib/internal/quic/quic.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1720,7 +1720,7 @@ class QuicStream {
17201720
* Promise that resolves once the stream is available and not pending.
17211721
* @type {Promise<void>}
17221722
*/
1723-
get ready() {
1723+
get opened() {
17241724
assertIsQuicStream(this);
17251725
return this.#inner.pendingStream.promise;
17261726
}

‎test/parallel/test-quic-stream-limits-pending.mjs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ const serverEndpoint = await listen(mustCall((serverSession) => {
3838
const clientSession = await connect(serverEndpoint.address);
3939
await clientSession.opened;
4040

41-
let ready = 0;
41+
let opened = 0;
4242

4343
// First stream opens immediately (within the limit).
4444
const s1 = await clientSession.createBidirectionalStream({
4545
body: encoder.encode('stream 1'),
4646
});
4747

4848
// eslint-disable-next-line node-core/must-call-assert
49-
s1.ready.then(() => {
50-
ready++;
49+
s1.opened.then(() => {
50+
opened++;
5151
});
5252

5353
// Second stream is created but queued as pending because the
@@ -57,14 +57,14 @@ const s2 = await clientSession.createBidirectionalStream({
5757
});
5858

5959
// eslint-disable-next-line node-core/must-call-assert
60-
s2.ready.then(() => {
61-
ready++;
60+
s2.opened.then(() => {
61+
opened++;
6262
});
6363

6464
// s2 should be pending until s1 closes and the server grants
6565
// more stream credits.
6666
assert.strictEqual(s2.pending, true);
67-
assert.strictEqual(ready, 1);
67+
assert.strictEqual(opened, 1);
6868

6969
// Drain and close the first stream.
7070
for await (const _ of s1) { /* drain */ } // eslint-disable-line no-unused-vars
@@ -73,7 +73,7 @@ await s1.closed;
7373
// After s1 closes, the server sends MAX_STREAMS which opens s2.
7474
// Wait for the server to receive both streams.
7575
await allDone.promise;
76-
assert.strictEqual(ready, 2);
76+
assert.strictEqual(opened, 2);
7777

7878
// s2 should no longer be pending.
7979
for await (const _ of s2) { /* drain */ } // eslint-disable-line no-unused-vars

‎test/parallel/test-quic-stream-limits-uni.mjs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ const serverEndpoint = await listen(mustCall((serverSession) => {
3434
const clientSession = await connect(serverEndpoint.address);
3535
await clientSession.opened;
3636

37-
let ready = 0;
37+
let opened = 0;
3838

3939
// First uni stream opens immediately.
4040
const s1 = await clientSession.createUnidirectionalStream({
4141
body: encoder.encode('uni 1'),
4242
});
4343

4444
// eslint-disable-next-line node-core/must-call-assert
45-
s1.ready.then(() => {
46-
ready++;
45+
s1.opened.then(() => {
46+
opened++;
4747
});
4848

4949
// Second uni stream is pending (limit = 1).
@@ -52,17 +52,17 @@ const s2 = await clientSession.createUnidirectionalStream({
5252
});
5353

5454
// eslint-disable-next-line node-core/must-call-assert
55-
s2.ready.then(() => {
56-
ready++;
55+
s2.opened.then(() => {
56+
opened++;
5757
});
58-
assert.strictEqual(ready, 1);
58+
assert.strictEqual(opened, 1);
5959

6060
assert.strictEqual(s2.pending, true);
6161

6262
// Wait for both to complete.
6363
await s1.closed;
6464
await allDone.promise;
65-
assert.strictEqual(ready, 2);
65+
assert.strictEqual(opened, 2);
6666
await s2.closed;
6767

6868
await clientSession.close();

0 commit comments

Comments
 (0)