diff options
author | Matteo Collina <hello@matteocollina.com> | 2019-10-01 17:30:39 +0200 |
---|---|---|
committer | Matteo Collina <hello@matteocollina.com> | 2019-12-03 12:14:52 +0100 |
commit | 8508edbf322bf0240f41a86fa379eb63550e5ec2 (patch) | |
tree | 40549bbba8995aee8bccd5f0d2b6163226ff8853 /lib/net.js | |
parent | 1b9fd7f6b8cbf14195f385bc839dba0b9a02f85e (diff) | |
download | android-node-v8-8508edbf322bf0240f41a86fa379eb63550e5ec2.tar.gz android-node-v8-8508edbf322bf0240f41a86fa379eb63550e5ec2.tar.bz2 android-node-v8-8508edbf322bf0240f41a86fa379eb63550e5ec2.zip |
net: implement capture rejections for 'connection' event
PR-URL: https://github.com/nodejs/node/pull/27867
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'lib/net.js')
-rw-r--r-- | lib/net.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/net.js b/lib/net.js index 02fd187480..7e5d0ea621 100644 --- a/lib/net.js +++ b/lib/net.js @@ -1653,6 +1653,19 @@ function emitCloseNT(self) { } +Server.prototype[EventEmitter.captureRejectionSymbol] = function( + err, event, sock) { + + switch (event) { + case 'connection': + sock.destroy(err); + break; + default: + this.emit('error', err); + } +}; + + // Legacy alias on the C++ wrapper object. This is not public API, so we may // want to runtime-deprecate it at some point. There's no hurry, though. ObjectDefineProperty(TCP.prototype, 'owner', { |