diff --git a/lib/dgram.js b/lib/dgram.js index 04828155f3a0d7..af1fd986fa5cdd 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -450,8 +450,8 @@ Socket.prototype.send = function(buffer, const afterDns = (ex, ip) => { defaultTriggerAsyncIdScope( this[async_id_symbol], - [ex, this, ip, list, address, port, callback], - doSend + doSend, + ex, this, ip, list, address, port, callback ); }; diff --git a/lib/internal/async_hooks.js b/lib/internal/async_hooks.js index 8307f67f66d52a..e0c7a44fc45742 100644 --- a/lib/internal/async_hooks.js +++ b/lib/internal/async_hooks.js @@ -263,7 +263,7 @@ function getDefaultTriggerAsyncId() { } -function defaultTriggerAsyncIdScope(triggerAsyncId, opaque, block) { +function defaultTriggerAsyncIdScope(triggerAsyncId, block, ...args) { // CHECK(Number.isSafeInteger(triggerAsyncId)) // CHECK(triggerAsyncId > 0) const oldDefaultTriggerAsyncId = async_id_fields[kDefaultTriggerAsyncId]; @@ -271,7 +271,7 @@ function defaultTriggerAsyncIdScope(triggerAsyncId, opaque, block) { var ret; try { - ret = Reflect.apply(block, null, opaque); + ret = Reflect.apply(block, null, args); } finally { async_id_fields[kDefaultTriggerAsyncId] = oldDefaultTriggerAsyncId; } diff --git a/lib/net.js b/lib/net.js index 43eb15605ff965..fb8a57424351ae 100644 --- a/lib/net.js +++ b/lib/net.js @@ -300,7 +300,7 @@ function onSocketFinish() { return this.destroy(); var err = defaultTriggerAsyncIdScope( - this[async_id_symbol], [this, afterShutdown], shutdownSocket + this[async_id_symbol], shutdownSocket, this, afterShutdown ); if (err) @@ -1031,7 +1031,7 @@ Socket.prototype.connect = function(...args) { path); } defaultTriggerAsyncIdScope( - this[async_id_symbol], [this, path], internalConnect + this[async_id_symbol], internalConnect, this, path ); } else { lookupAndConnect(this, options); @@ -1073,8 +1073,8 @@ function lookupAndConnect(self, options) { if (self.connecting) defaultTriggerAsyncIdScope( self[async_id_symbol], - [self, host, port, addressType, localAddress, localPort], - internalConnect + internalConnect, + self, host, port, addressType, localAddress, localPort ); }); return; @@ -1096,7 +1096,7 @@ function lookupAndConnect(self, options) { debug('connect: dns options', dnsopts); self._host = host; var lookup = options.lookup || dns.lookup; - defaultTriggerAsyncIdScope(self[async_id_symbol], [], function() { + defaultTriggerAsyncIdScope(self[async_id_symbol], function() { lookup(host, dnsopts, function emitLookup(err, ip, addressType) { self.emit('lookup', err, ip, addressType, host); @@ -1118,8 +1118,8 @@ function lookupAndConnect(self, options) { self._unrefTimer(); defaultTriggerAsyncIdScope( self[async_id_symbol], - [self, ip, port, addressType, localAddress, localPort], - internalConnect + internalConnect, + self, ip, port, addressType, localAddress, localPort ); } });