diff options
author | James M Snell <jasnell@gmail.com> | 2020-07-08 00:03:56 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2020-07-09 17:14:12 +0300 |
commit | afc9390ae58bdd7e5631402e4d3a0219d7f25993 (patch) | |
tree | 3bfbe6a277c1209a635e4f431e6ca5febb82dcf4 /lib/internal/quic | |
parent | e3813261b87f813cbd0cdc5199434de44b2a0c6a (diff) |
quic: refactor/improve QuicSocket ready event handling
PR-URL: https://github.com/nodejs/node/pull/34247
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'lib/internal/quic')
-rw-r--r-- | lib/internal/quic/core.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/internal/quic/core.js b/lib/internal/quic/core.js index d70b99378a2..a35acb265bd 100644 --- a/lib/internal/quic/core.js +++ b/lib/internal/quic/core.js @@ -1031,7 +1031,13 @@ class QuicSocket extends EventEmitter { // used to either listen or connect. No QuicServerSession should // exist before this event, and all QuicClientSession will remain // in Initial states until ready is invoked. - process.nextTick(emit.bind(this, 'ready')); + process.nextTick(() => { + try { + this.emit('ready'); + } catch (error) { + this.destroy(error); + } + }); } // Called when a QuicEndpoint closes |