MCPcopy Create free account
hub / github.com/angular/dev-infra / TunnelingAgent

Function TunnelingAgent

github-actions/browserstack/set-browserstack-env.js:216–236  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

214 return agent;
215 }
216 function TunnelingAgent(options) {
217 var self = this;
218 self.options = options || {};
219 self.proxyOptions = self.options.proxy || {};
220 self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets;
221 self.requests = [];
222 self.sockets = [];
223 self.on("free", function onFree(socket, host, port, localAddress) {
224 var options2 = toOptions(host, port, localAddress);
225 for (var i = 0, len = self.requests.length; i < len; ++i) {
226 var pending = self.requests[i];
227 if (pending.host === options2.host && pending.port === options2.port) {
228 self.requests.splice(i, 1);
229 pending.request.onSocket(socket);
230 return;
231 }
232 }
233 socket.destroy();
234 self.removeSocket(socket);
235 });
236 }
237 util.inherits(TunnelingAgent, events2.EventEmitter);
238 TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) {
239 var self = this;

Callers

nothing calls this directly

Calls 3

toOptionsFunction · 0.70
onMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected