镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/dgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,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
);
};

Expand Down
4 changes: 2 additions & 2 deletions lib/internal/async_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,15 @@ 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];
async_id_fields[kDefaultTriggerAsyncId] = triggerAsyncId;

var ret;
try {
ret = Reflect.apply(block, null, opaque);
ret = Reflect.apply(block, null, args);
} finally {
async_id_fields[kDefaultTriggerAsyncId] = oldDefaultTriggerAsyncId;
}
Expand Down
14 changes: 7 additions & 7 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,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)
Expand Down Expand Up @@ -1043,7 +1043,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);
Expand Down Expand Up @@ -1089,8 +1089,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;
Expand Down Expand Up @@ -1118,7 +1118,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);

Expand All @@ -1140,8 +1140,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
);
}
});
Expand Down