diff options
author | James M Snell <jasnell@gmail.com> | 2020-07-10 02:31:41 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2020-07-16 03:16:48 +0300 |
commit | 53b12f0c7bf0df695c9640adccead3c9142552d5 (patch) | |
tree | c42aaafa4a813705cb557508c3d887b6652d01b5 /doc/api/quic.md | |
parent | 16b32eae3e76348c954e46965739fbfb91d097bd (diff) |
quic: implement QuicEndpoint Promise API
This is the start of a conversion over to a fully Promise-centric API
for the QUIC implementation.
PR-URL: https://github.com/nodejs/node/pull/34283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'doc/api/quic.md')
-rw-r--r-- | doc/api/quic.md | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/doc/api/quic.md b/doc/api/quic.md index 46f521789ef..dee7f65f55c 100644 --- a/doc/api/quic.md +++ b/doc/api/quic.md @@ -338,6 +338,34 @@ The object will contain the properties: If the `QuicEndpoint` is not bound, `quicendpoint.address` is an empty object. +#### quicendpoint.bind(\[options\]) +<!-- YAML + added: REPLACEME +--> + +Binds the `QuicEndpoint` if it has not already been bound. User code will +not typically be responsible for binding a `QuicEndpoint` as the owning +`QuicSocket` will do that automatically. + +* `options` {object} + * `signal` {AbortSignal} Optionally allows the `bind()` to be canceled + using an `AbortController`. +* Returns: {Promise} + +The `quicendpoint.bind()` function returns `Promise` that will be resolved +with the address once the bind operation is successful. + +If the `QuicEndpoint` has been destroyed, or is destroyed while the `Promise` +is pending, the `Promise` will be rejected with an `ERR_INVALID_STATE` error. + +If an `AbortSignal` is specified in the `options` and it is triggered while +the `Promise` is pending, the `Promise` will be rejected with an `AbortError`. + +If `quicendpoint.bind()` is called again while a previously returned `Promise` +is still pending or has already successfully resolved, the previously returned +pending `Promise` will be returned. If the additional call to +`quicendpoint.bind()` contains an `AbortSignal`, the `signal` will be ignored. + #### quicendpoint.bound <!-- YAML added: REPLACEME @@ -347,6 +375,20 @@ added: REPLACEME Set to `true` if the `QuicEndpoint` is bound to the local UDP port. +#### quicendpoint.close() +<!-- YAML +added: REPLACEME +--> + +Closes and destroys the `QuicEndpoint`. Returns a `Promise` that is resolved +once the `QuicEndpoint` has been destroyed, or rejects if the `QuicEndpoint` +is destroyed with an error. + +* Returns: {Promise} + +The `Promise` cannot be canceled. Once `quicendpoint.close()` is called, the +`QuicEndpoint` will be destroyed. + #### quicendpoint.closing <!-- YAML added: REPLACEME |