* Gracefully closes the session. Any streams created on the session will be * allowed to complete gracefully and any datagrams that have already been * queued for sending will be allowed to complete. Once all streams have been * completed and all datagrams have been sent, the session will b
(options = kEmptyObject)
| 3446 | * @returns {Promise<void>} |
| 3447 | */ |
| 3448 | close(options = kEmptyObject) { |
| 3449 | assertIsQuicSession(this); |
| 3450 | options = validateCloseOptions(options); |
| 3451 | const inner = this.#inner; |
| 3452 | if (!this.#isClosedOrClosing) { |
| 3453 | inner.isPendingClose = true; |
| 3454 | if (options?.code !== undefined) { |
| 3455 | inner.selfInitiatedClose = true; |
| 3456 | } |
| 3457 | |
| 3458 | debug('gracefully closing the session'); |
| 3459 | |
| 3460 | this.#handle.gracefulClose(options); |
| 3461 | if (onSessionClosingChannel.hasSubscribers) { |
| 3462 | onSessionClosingChannel.publish({ |
| 3463 | __proto__: null, |
| 3464 | session: this, |
| 3465 | }); |
| 3466 | } |
| 3467 | } |
| 3468 | return this.closed; |
| 3469 | } |
| 3470 | |
| 3471 | /** @type {boolean} */ |
| 3472 | get closing() { |
no test coverage detected