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

Function connectH1

github-actions/saucelabs/set-saucelabs-env.js:6445–6564  ·  view source on GitHub ↗
(client, socket)

Source from the content-addressed store, hash-verified

6443 }
6444 } else if (timeoutType === TIMEOUT_BODY) {
6445 if (!paused) {
6446 util.destroy(socket, new BodyTimeoutError());
6447 }
6448 } else if (timeoutType === TIMEOUT_KEEP_ALIVE) {
6449 assert(client[kRunning] === 0 && client[kKeepAliveTimeoutValue]);
6450 util.destroy(socket, new InformationalError("socket idle timeout"));
6451 }
6452 }
6453 function connectH1(client, socket) {
6454 return __async(this, null, function* () {
6455 client[kSocket] = socket;
6456 if (!llhttpInstance) {
6457 llhttpInstance = yield llhttpPromise;
6458 llhttpPromise = null;
6459 }
6460 socket[kNoRef] = false;
6461 socket[kWriting] = false;
6462 socket[kReset] = false;
6463 socket[kBlocking] = false;
6464 socket[kIdleSocketValidation] = 0;
6465 socket[kIdleSocketValidationTimeout] = null;
6466 socket[kSocketUsed] = false;
6467 socket[kParser] = new Parser(client, socket, llhttpInstance);
6468 addListener(socket, "error", function(err) {
6469 assert(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
6470 const parser = this[kParser];
6471 if (err.code === "ECONNRESET" && parser.statusCode && !parser.shouldKeepAlive) {
6472 const parserErr = parser.finish();
6473 if (parserErr) {
6474 this[kError] = parserErr;
6475 this[kClient][kOnError](parserErr);
6476 }
6477 return;
6478 }
6479 this[kError] = err;
6480 this[kClient][kOnError](err);
6481 });
6482 addListener(socket, "readable", function() {
6483 const parser = this[kParser];
6484 if (parser) {
6485 parser.readMore();
6486 }
6487 });
6488 addListener(socket, "end", function() {
6489 const parser = this[kParser];
6490 if (parser.statusCode && !parser.shouldKeepAlive) {
6491 const parserErr = parser.finish();
6492 if (parserErr) {
6493 util.destroy(this, parserErr);
6494 }
6495 return;
6496 }
6497 util.destroy(this, new SocketError("other side closed", util.getSocketInfo(this)));
6498 });
6499 addListener(socket, "close", function() {
6500 const client2 = this[kClient];
6501 const parser = this[kParser];
6502 clearIdleSocketValidation(this);

Callers 1

connectFunction · 0.70

Calls 7

__asyncFunction · 0.70
addListenerFunction · 0.70
finishMethod · 0.45
readMoreMethod · 0.45
destroyMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected