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

Function connect

github-actions/saucelabs/set-saucelabs-env.js:8101–8211  ·  view source on GitHub ↗
(client)

Source from the content-addressed store, hash-verified

8099 }
8100 this[kResume]();
8101 });
8102 });
8103 }
8104 };
8105 var createRedirectInterceptor = require_redirect_interceptor();
8106 function onError(client, err) {
8107 if (client[kRunning] === 0 && err.code !== "UND_ERR_INFO" && err.code !== "UND_ERR_SOCKET") {
8108 assert(client[kPendingIdx] === client[kRunningIdx]);
8109 const requests = client[kQueue].splice(client[kRunningIdx]);
8110 for (let i = 0; i < requests.length; i++) {
8111 const request = requests[i];
8112 util.errorRequest(client, request, err);
8113 }
8114 assert(client[kSize] === 0);
8115 }
8116 }
8117 function connect(client) {
8118 return __async(this, null, function* () {
8119 var _a, _b, _c;
8120 assert(!client[kConnecting]);
8121 assert(!client[kHTTPContext]);
8122 let { host, hostname, protocol, port } = client[kUrl];
8123 if (hostname[0] === "[") {
8124 const idx = hostname.indexOf("]");
8125 assert(idx !== -1);
8126 const ip = hostname.substring(1, idx);
8127 assert(net.isIP(ip));
8128 hostname = ip;
8129 }
8130 client[kConnecting] = true;
8131 if (channels.beforeConnect.hasSubscribers) {
8132 channels.beforeConnect.publish({
8133 connectParams: {
8134 host,
8135 hostname,
8136 protocol,
8137 port,
8138 version: (_a = client[kHTTPContext]) == null ? void 0 : _a.version,
8139 servername: client[kServerName],
8140 localAddress: client[kLocalAddress]
8141 },
8142 connector: client[kConnector]
8143 });
8144 }
8145 try {
8146 const socket = yield new Promise((resolve2, reject) => {
8147 client[kConnector]({
8148 host,
8149 hostname,
8150 protocol,
8151 port,
8152 servername: client[kServerName],
8153 localAddress: client[kLocalAddress]
8154 }, (err, socket2) => {
8155 if (err) {
8156 reject(err);
8157 } else {
8158 resolve2(socket2);

Callers 2

[kConnect]Method · 0.70
_resumeFunction · 0.70

Calls 9

__asyncFunction · 0.70
connectH2Function · 0.70
connectH1Function · 0.70
onErrorFunction · 0.70
__spreadPropsFunction · 0.70
__spreadValuesFunction · 0.70
destroyMethod · 0.45
onMethod · 0.45
dispatchMethod · 0.45

Tested by

no test coverage detected