aboutsummaryrefslogtreecommitdiff
path: root/src/js/node/http.js
diff options
context:
space:
mode:
authorGravatar Dylan Conway <35280289+dylan-conway@users.noreply.github.com> 2023-06-29 15:47:00 -0700
committerGravatar GitHub <noreply@github.com> 2023-06-29 15:47:00 -0700
commit7af757d104763a84e0c6d0b36eb0055afe1c40fa (patch)
tree8159d124cd670cee9b5f5a91f3a2e5f1189aa938 /src/js/node/http.js
parent9c66fdc70350fb34102d79e101a2d4a64ba41365 (diff)
downloadbun-7af757d104763a84e0c6d0b36eb0055afe1c40fa.tar.gz
bun-7af757d104763a84e0c6d0b36eb0055afe1c40fa.tar.zst
bun-7af757d104763a84e0c6d0b36eb0055afe1c40fa.zip
add setters for `Agent` properties (#3460)
* make `Agent` properties public * back to private, added setters * change properties to public
Diffstat (limited to 'src/js/node/http.js')
-rw-r--r--src/js/node/http.js108
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() {