diff options
Diffstat (limited to 'src/js/node/http.js')
-rw-r--r-- | src/js/node/http.js | 108 |
1 files changed, 28 insertions, 80 deletions
diff --git a/src/js/node/http.js b/src/js/node/http.js index 658e45433..fe9730101 100644 --- a/src/js/node/http.js +++ b/src/js/node/http.js @@ -173,20 +173,20 @@ export function createServer(options, callback) { } export class Agent extends EventEmitter { - #defaultPort = 80; - #protocol = "http:"; - #options; - #requests; - #sockets; - #freeSockets; - - #keepAliveMsecs; - #keepAlive; - #maxSockets; - #maxFreeSockets; - #scheduling; - #maxTotalSockets; - #totalSocketCount; + defaultPort = 80; + protocol = "http:"; + options; + requests; + sockets; + freeSockets; + + keepAliveMsecs; + keepAlive; + maxSockets; + maxFreeSockets; + scheduling; + maxTotalSockets; + totalSocketCount; #fakeSocket; @@ -200,75 +200,23 @@ export class Agent extends EventEmitter { constructor(options = kEmptyObject) { super(); - this.#options = options = { ...options, path: null }; + this.options = options = { ...options, path: null }; if (options.noDelay === undefined) options.noDelay = true; // Don't confuse net and make it think that we're connecting to a pipe - this.#requests = kEmptyObject; - this.#sockets = kEmptyObject; - this.#freeSockets = kEmptyObject; - - this.#keepAliveMsecs = options.keepAliveMsecs || 1000; - this.#keepAlive = options.keepAlive || false; - this.#maxSockets = options.maxSockets || Agent.defaultMaxSockets; - this.#maxFreeSockets = options.maxFreeSockets || 256; - this.#scheduling = options.scheduling || "lifo"; - this.#maxTotalSockets = options.maxTotalSockets; - this.#totalSocketCount = 0; - this.#defaultPort = options.defaultPort || 80; - this.#protocol = options.protocol || "http:"; - } - - get defaultPort() { - return this.#defaultPort; - } - - get protocol() { - return this.#protocol; - } - - get requests() { - return this.#requests; - } - - get sockets() { - return this.#sockets; - } - - get freeSockets() { - return this.#freeSockets; - } - - get options() { - return this.#options; - } - - get keepAliveMsecs() { - return this.#keepAliveMsecs; - } - - get keepAlive() { - return this.#keepAlive; - } - - get maxSockets() { - return this.#maxSockets; - } - - get maxFreeSockets() { - return this.#maxFreeSockets; - } - - get scheduling() { - return this.#scheduling; - } - - get maxTotalSockets() { - return this.#maxTotalSockets; - } - - get totalSocketCount() { - return this.#totalSocketCount; + this.requests = kEmptyObject; + this.sockets = kEmptyObject; + this.freeSockets = kEmptyObject; + + this.keepAliveMsecs = options.keepAliveMsecs || 1000; + this.keepAlive = options.keepAlive || false; + this.maxSockets = options.maxSockets || Agent.defaultMaxSockets; + this.maxFreeSockets = options.maxFreeSockets || 256; + this.scheduling = options.scheduling || "lifo"; + this.maxTotalSockets = options.maxTotalSockets; + this.totalSocketCount = 0; + this.defaultPort = options.defaultPort || 80; + this.protocol = options.protocol || "http:"; } createConnection() { |