diff --git a/lib/dgram.js b/lib/dgram.js index 59534b6c269d3d..cd70dc5be91f0d 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 fb4003a45ad93a..6c5e69e63b3654 100644 --- a/lib/internal/async_hooks.js +++ b/lib/internal/async_hooks.js @@ -260,7 +260,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]; @@ -268,7 +268,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 6e21e9d6c83ee6..886365092c05a6 100644 --- a/lib/net.js +++ b/lib/net.js @@ -304,7 +304,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) @@ -1017,7 +1017,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); @@ -1063,8 +1063,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; @@ -1092,7 +1092,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); @@ -1114,8 +1114,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 ); } });