From 16b32eae3e76348c954e46965739fbfb91d097bd Mon Sep 17 00:00:00 2001 From: James M Snell Date: Thu, 9 Jul 2020 14:16:51 -0700 Subject: [PATCH] quic: handle unhandled rejections on QuicSession PR-URL: https://github.com/nodejs/node/pull/34283 Reviewed-By: Anna Henningsen --- lib/internal/quic/core.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/internal/quic/core.js b/lib/internal/quic/core.js index 1af67c031c81fa..65a204decc3e53 100644 --- a/lib/internal/quic/core.js +++ b/lib/internal/quic/core.js @@ -1688,6 +1688,10 @@ class QuicSession extends EventEmitter { socket[kAddSession](this); } + [kRejections](err, eventname, ...args) { + this.destroy(err); + } + // Used to get the configured options for peer initiated QuicStream // instances. get [kStreamOptions]() { @@ -1702,7 +1706,11 @@ class QuicSession extends EventEmitter { const state = this[kInternalState]; state.qlogStream = stream; process.nextTick(() => { - this.emit('qlog', state.qlogStream); + try { + this.emit('qlog', state.qlogStream); + } catch (error) { + this.destroy(error); + } }); }