Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Mar 18, 2022
1 parent f449552 commit e7cebaa
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions 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')
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions lib/client.js
Expand Up @@ -60,7 +60,8 @@ const {
kMaxRequests,
kCounter,
kClose,
kDestroy
kDestroy,
kDispatch
} = require('./core/symbols')

const kClosedResolve = Symbol('kClosedResolve')
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions 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'),
Expand Down
4 changes: 2 additions & 2 deletions lib/dispatcher-base.js
Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions lib/pool-base.js
Expand Up @@ -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')
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit e7cebaa

Please sign in to comment.