From 8640fb875700dbd4888c51dbd84234a97497d0ef Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 26 Oct 2019 20:47:41 +0200 Subject: [PATCH] quic: add pending state for streams This resolves the situation in which `openStream()` is called before the underlying native `QuicSession` handle exists. Fixes: https://github.com/nodejs/quic/issues/181 PR-URL: https://github.com/nodejs/quic/pull/187 Reviewed-By: James M Snell --- doc/api/quic.md | 19 +++++ lib/internal/quic/core.js | 77 ++++++++++++++----- test/parallel/test-quic-openstream-pending.js | 70 +++++++++++++++++ 3 files changed, 145 insertions(+), 21 deletions(-) create mode 100644 test/parallel/test-quic-openstream-pending.js diff --git a/doc/api/quic.md b/doc/api/quic.md index 573da7e4f0..7a12753c7d 100644 --- a/doc/api/quic.md +++ b/doc/api/quic.md @@ -1102,6 +1102,15 @@ stream('initialHeaders', (headers) => { }); ``` +### Event: `'ready'` + + +Emitted when the underlying `QuicSession` has emitted its `secure` event +this stream has received its id, which is accessible as `stream.id` once this +event is emitted. + ### Event: `'trailingHeaders'` + +* {boolean} + +This property is `true` if the underlying session is not finished yet, +i.e. before the `'ready'` event is emitted. + ### quicstream.serverInitiated