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

Function connectH1

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

Source from the content-addressed store, hash-verified

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