summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Nagy <ronagy@icloud.com>2019-10-01 20:21:22 +0200
committerRich Trott <rtrott@gmail.com>2019-10-03 15:25:52 -0700
commita57da278f852adfe10a52e9a3ea0b95b3e6e7590 (patch)
tree2bcc7a850afbdfada669f13edeebba3cc5eaafc2 /lib
parent1a25e901b7c380929f0d08599f49dd77897a627f (diff)
downloadandroid-node-v8-a57da278f852adfe10a52e9a3ea0b95b3e6e7590.tar.gz
android-node-v8-a57da278f852adfe10a52e9a3ea0b95b3e6e7590.tar.bz2
android-node-v8-a57da278f852adfe10a52e9a3ea0b95b3e6e7590.zip
net: emit close on unconnected socket
Socket should always emit 'close'. Regardless whether it has been connected or not. PR-URL: https://github.com/nodejs/node/pull/29803 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/net.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/net.js b/lib/net.js
index 760bf084f4..baaf2180d1 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -660,10 +660,12 @@ Socket.prototype._destroy = function(exception, cb) {
this._handle.onread = noop;
this._handle = null;
this._sockname = null;
+ cb(exception);
+ } else {
+ cb(exception);
+ process.nextTick(emitCloseNT, this);
}
- cb(exception);
-
if (this._server) {
debug('has server');
this._server._connections--;