Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2020-07-09 23:52:15 +0300
committerJames M Snell <jasnell@gmail.com>2020-07-16 03:16:41 +0300
commit9f552df5b4892530e3c8cabc31705b265c317304 (patch)
tree9fc62956bfc4ce6b5410aaf65cd3be3930ba966e /lib/internal/quic
parentb80108c033325c00dabbde945522e7f3535a3977 (diff)
quic: fix endpointClose error handling, document
PR-URL: https://github.com/nodejs/node/pull/34283 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'lib/internal/quic')
-rw-r--r--lib/internal/quic/core.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/internal/quic/core.js b/lib/internal/quic/core.js
index 3aebecd47c8..d76478ff52b 100644
--- a/lib/internal/quic/core.js
+++ b/lib/internal/quic/core.js
@@ -1056,12 +1056,17 @@ class QuicSocket extends EventEmitter {
[kEndpointClose](endpoint, error) {
const state = this[kInternalState];
state.endpoints.delete(endpoint);
- process.nextTick(emit.bind(this, 'endpointClose', endpoint, error));
+ process.nextTick(() => {
+ try {
+ this.emit('endpointClose', endpoint, error);
+ } catch (error) {
+ this.destroy(error);
+ }
+ });
// If there are no more QuicEndpoints, the QuicSocket is no
// longer usable.
if (state.endpoints.size === 0) {
- // Ensure that there are absolutely no additional sessions
for (const session of state.sessions)
session.destroy(error);