Skip to content

Commit

Permalink
fixup: rename newUid to newAsyncId
Browse files Browse the repository at this point in the history
  • Loading branch information
apapirovski committed Feb 16, 2018
1 parent 029cd57 commit 2abd4a7
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions lib/async_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const {
enableHooks,
disableHooks,
// Internal Embedder API
newUid,
newAsyncId,
getDefaultTriggerAsyncId,
emitInit,
emitBefore,
Expand Down Expand Up @@ -157,7 +157,7 @@ class AsyncResource {
triggerAsyncId);
}

this[async_id_symbol] = newUid();
this[async_id_symbol] = newAsyncId();
this[trigger_async_id_symbol] = triggerAsyncId;
// this prop name (destroyed) has to be synchronized with C++
this[destroyedSymbol] = { destroyed: false };
Expand Down
6 changes: 3 additions & 3 deletions lib/internal/async_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ function disableHooks() {
// Increment the internal id counter and return the value. Important that the
// counter increment first. Since it's done the same way in
// Environment::new_async_uid()
function newUid() {
function newAsyncId() {
return ++async_id_fields[kAsyncIdCounter];
}

Expand All @@ -256,7 +256,7 @@ function getOrSetAsyncId(object) {
return object[async_id_symbol];
}

return object[async_id_symbol] = newUid();
return object[async_id_symbol] = newAsyncId();
}


Expand Down Expand Up @@ -436,7 +436,7 @@ module.exports = {
clearAsyncIdStack,
hasAsyncIdStack,
// Internal Embedder API
newUid,
newAsyncId,
getOrSetAsyncId,
getDefaultTriggerAsyncId,
defaultTriggerAsyncIdScope,
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/process/next_tick.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports.nextTick = null;
function setupNextTick() {
const {
getDefaultTriggerAsyncId,
newUid,
newAsyncId,
initHooksExist,
destroyHooksExist,
emitInit,
Expand Down Expand Up @@ -129,7 +129,7 @@ function setupNextTick() {
this.callback = callback;
this.args = args;

const asyncId = newUid();
const asyncId = newAsyncId();
this[async_id_symbol] = asyncId;
this[trigger_async_id_symbol] = triggerAsyncId;

Expand Down
4 changes: 2 additions & 2 deletions lib/internal/timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const {
getDefaultTriggerAsyncId,
newUid,
newAsyncId,
initHooksExist,
emitInit
} = require('internal/async_hooks');
Expand Down Expand Up @@ -66,7 +66,7 @@ function Timeout(callback, after, args, isRepeat, isUnrefed) {

this[unrefedSymbol] = isUnrefed;

this[async_id_symbol] = newUid();
this[async_id_symbol] = newAsyncId();
this[trigger_async_id_symbol] = getDefaultTriggerAsyncId();
if (initHooksExist()) {
emitInit(this[async_id_symbol],
Expand Down
4 changes: 2 additions & 2 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const { TCPConnectWrap } = process.binding('tcp_wrap');
const { PipeConnectWrap } = process.binding('pipe_wrap');
const { ShutdownWrap, WriteWrap } = process.binding('stream_wrap');
const {
newUid,
newAsyncId,
defaultTriggerAsyncIdScope,
symbols: { async_id_symbol }
} = require('internal/async_hooks');
Expand Down Expand Up @@ -94,7 +94,7 @@ function createHandle(fd, is_server) {

function getNewAsyncId(handle) {
return (!handle || typeof handle.getAsyncId !== 'function') ?
newUid() : handle.getAsyncId();
newAsyncId() : handle.getAsyncId();
}


Expand Down
6 changes: 3 additions & 3 deletions lib/timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const errors = require('internal/errors');
const debug = util.debuglog('timer');
const {
getDefaultTriggerAsyncId,
newUid,
newAsyncId,
initHooksExist,
destroyHooksExist,
// The needed emit*() functions.
Expand Down Expand Up @@ -188,7 +188,7 @@ function insert(item, unrefed, start) {

if (!item[async_id_symbol] || item._destroyed) {
item._destroyed = false;
item[async_id_symbol] = newUid();
item[async_id_symbol] = newAsyncId();
item[trigger_async_id_symbol] = getDefaultTriggerAsyncId();
if (initHooksExist()) {
emitInit(item[async_id_symbol],
Expand Down Expand Up @@ -720,7 +720,7 @@ const Immediate = class Immediate {
this._destroyed = false;
this[kRefed] = false;

this[async_id_symbol] = newUid();
this[async_id_symbol] = newAsyncId();
this[trigger_async_id_symbol] = getDefaultTriggerAsyncId();
if (initHooksExist()) {
emitInit(this[async_id_symbol],
Expand Down
4 changes: 2 additions & 2 deletions test/async-hooks/test-emit-before-after.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ assert.strictEqual(
'RangeError [ERR_INVALID_ASYNC_ID]: Invalid triggerAsyncId value: -2');
assert.strictEqual(c2.status, 1);

const expectedId = async_hooks.newUid();
const expectedTriggerId = async_hooks.newUid();
const expectedId = async_hooks.newAsyncId();
const expectedTriggerId = async_hooks.newAsyncId();
const expectedType = 'test_emit_before_after_type';

// Verify that if there is no registered hook, then nothing will happen.
Expand Down
4 changes: 2 additions & 2 deletions test/async-hooks/test-emit-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const spawnSync = require('child_process').spawnSync;
const async_hooks = require('internal/async_hooks');
const initHooks = require('./init-hooks');

const expectedId = async_hooks.newUid();
const expectedTriggerId = async_hooks.newUid();
const expectedId = async_hooks.newAsyncId();
const expectedTriggerId = async_hooks.newAsyncId();
const expectedType = 'test_emit_init_type';
const expectedResource = { key: 'test_emit_init_resource' };

Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-http-client-immediate-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const net = require('net');
const http = require('http');
const uv = process.binding('uv');
const {
newUid,
newAsyncId,
symbols: { async_id_symbol }
} = require('internal/async_hooks');

Expand All @@ -28,7 +28,7 @@ agent.createConnection = common.mustCall((cfg) => {
};

// Simulate just enough socket handle initialization
sock[async_id_symbol] = newUid();
sock[async_id_symbol] = newAsyncId();

sock.connect(cfg);
return sock;
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-process-geteuid-getegid.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ assert.notStrictEqual(newgid, oldgid);

const olduid = process.geteuid();
process.seteuid('nobody');
const newuid = process.geteuid();
assert.notStrictEqual(newuid, olduid);
const newAsyncId = process.geteuid();
assert.notStrictEqual(newAsyncId, olduid);
4 changes: 2 additions & 2 deletions test/parallel/test-process-setuid-setgid.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ assert.notStrictEqual(newgid, oldgid);

const olduid = process.getuid();
process.setuid('nobody');
const newuid = process.getuid();
assert.notStrictEqual(newuid, olduid);
const newAsyncId = process.getuid();
assert.notStrictEqual(newAsyncId, olduid);

0 comments on commit 2abd4a7

Please sign in to comment.