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

Function writeH2

github-actions/browserstack/set-browserstack-env.js:7246–7478  ·  view source on GitHub ↗
(client, request)

Source from the content-addressed store, hash-verified

7244 });
7245 util.addListener(socket, "end", function() {
7246 util.destroy(this, new SocketError("other side closed", util.getSocketInfo(this)));
7247 });
7248 util.addListener(socket, "close", function() {
7249 const err = this[kError] || new SocketError("closed", util.getSocketInfo(this));
7250 client[kSocket] = null;
7251 if (this[kHTTP2Session] != null) {
7252 this[kHTTP2Session].destroy(err);
7253 }
7254 client[kPendingIdx] = client[kRunningIdx];
7255 assert(client[kRunning] === 0);
7256 client.emit("disconnect", client[kUrl], [client], err);
7257 client[kResume]();
7258 });
7259 let closed = false;
7260 socket.on("close", () => {
7261 closed = true;
7262 });
7263 return {
7264 version: "h2",
7265 defaultPipelining: Infinity,
7266 write(...args) {
7267 return writeH2(client, ...args);
7268 },
7269 resume() {
7270 resumeH2(client);
7271 },
7272 destroy(err, callback) {
7273 if (closed) {
7274 queueMicrotask(callback);
7275 } else {
7276 socket.destroy(err).on("close", callback);
7277 }
7278 },
7279 get destroyed() {
7280 return socket.destroyed;
7281 },
7282 busy() {
7283 return false;
7284 }
7285 };
7286 });
7287 }
7288 function resumeH2(client) {
7289 const socket = client[kSocket];
7290 if ((socket == null ? void 0 : socket.destroyed) === false) {
7291 if (client[kSize] === 0 && client[kMaxConcurrentStreams] === 0) {
7292 socket.unref();
7293 client[kHTTP2Session].unref();
7294 } else {
7295 socket.ref();
7296 client[kHTTP2Session].ref();
7297 }
7298 }
7299 }
7300 function onHttp2SessionError(err) {
7301 this[kSocket][kError] = err;
7302 this[kClient][kOnError](err);
7303 }

Callers 1

writeFunction · 0.70

Calls 15

extractBodyFunction · 0.70
shouldSendContentLengthFunction · 0.70
writeBodyH2Function · 0.70
__objRestFunction · 0.70
__restKeyFunction · 0.70
parseH2HeadersFunction · 0.70
abortFunction · 0.70
onConnectMethod · 0.45
onUpgradeMethod · 0.45
onResponseStartedMethod · 0.45
destroyMethod · 0.45
onHeadersMethod · 0.45

Tested by

no test coverage detected