From e7cebaaa5c73b776a197dbf576c14ab72e093372 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Fri, 18 Mar 2022 21:17:04 +0100 Subject: [PATCH] fixup --- lib/agent.js | 4 ++-- lib/client.js | 5 +++-- lib/core/symbols.js | 1 + lib/dispatcher-base.js | 4 ++-- lib/pool-base.js | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/agent.js b/lib/agent.js index fa53569e378..47aa2365e61 100644 --- a/lib/agent.js +++ b/lib/agent.js @@ -1,7 +1,7 @@ 'use strict' const { InvalidArgumentError } = require('./core/errors') -const { kClients, kRunning, kClose, kDestroy } = require('./core/symbols') +const { kClients, kRunning, kClose, kDestroy, kDispatch } = require('./core/symbols') const DispatcherBase = require('./dispatcher-base') const Pool = require('./pool') const Client = require('./client') @@ -86,7 +86,7 @@ class Agent extends DispatcherBase { return ret } - _dispatch (opts, handler) { + [kDispatch] (opts, handler) { let key if (opts.origin && (typeof opts.origin === 'string' || opts.origin instanceof URL)) { key = String(opts.origin) diff --git a/lib/client.js b/lib/client.js index 198f2624232..d3d4cfc705d 100644 --- a/lib/client.js +++ b/lib/client.js @@ -60,7 +60,8 @@ const { kMaxRequests, kCounter, kClose, - kDestroy + kDestroy, + kDispatch } = require('./core/symbols') const kClosedResolve = Symbol('kClosedResolve') @@ -253,7 +254,7 @@ class Client extends DispatcherBase { this.once('connect', cb) } - _dispatch (opts, handler) { + [kDispatch] (opts, handler) { const { maxRedirections = this[kMaxRedirections] } = opts if (maxRedirections) { handler = new RedirectHandler(this, maxRedirections, opts, handler) diff --git a/lib/core/symbols.js b/lib/core/symbols.js index 74414e40e37..30108827a84 100644 --- a/lib/core/symbols.js +++ b/lib/core/symbols.js @@ -1,6 +1,7 @@ module.exports = { kClose: Symbol('close'), kDestroy: Symbol('destroy'), + kDispatch: Symbol('dispatch'), kUrl: Symbol('url'), kWriting: Symbol('writing'), kResuming: Symbol('resuming'), diff --git a/lib/dispatcher-base.js b/lib/dispatcher-base.js index f99366c3c4b..2c12ba80f35 100644 --- a/lib/dispatcher-base.js +++ b/lib/dispatcher-base.js @@ -6,7 +6,7 @@ const { ClientClosedError, InvalidArgumentError } = require('./core/errors') -const { kDestroy, kClose } = require('./core/symbols') +const { kDestroy, kClose, kDispatch } = require('./core/symbols') const kDestroyed = Symbol('destroyed') const kClosed = Symbol('closed') @@ -143,7 +143,7 @@ class DispatcherBase extends Dispatcher { throw new ClientClosedError() } - return this._dispatch(opts, handler) + return this[kDispatch](opts, handler) } catch (err) { if (typeof handler.onError !== 'function') { throw new InvalidArgumentError('invalid onError method') diff --git a/lib/pool-base.js b/lib/pool-base.js index bfb19839720..2a909eee083 100644 --- a/lib/pool-base.js +++ b/lib/pool-base.js @@ -2,7 +2,7 @@ const DispatcherBase = require('./dispatcher-base') const FixedQueue = require('./node/fixed-queue') -const { kConnected, kSize, kRunning, kPending, kQueued, kBusy, kFree, kUrl, kClose, kDestroy } = require('./core/symbols') +const { kConnected, kSize, kRunning, kPending, kQueued, kBusy, kFree, kUrl, kClose, kDestroy, kDispatch } = require('./core/symbols') const PoolStats = require('./pool-stats') const kClients = Symbol('clients') @@ -133,7 +133,7 @@ class PoolBase extends DispatcherBase { return Promise.all(this[kClients].map(c => c.destroy(err))) } - _dispatch (opts, handler) { + [kDispatch] (opts, handler) { const dispatcher = this[kGetDispatcher]() if (!dispatcher) {