MCPcopy Index your code
hub / github.com/nodejs/node / onHttp2SessionGoAway

Function onHttp2SessionGoAway

deps/undici/undici.js:8665–8703  ·  view source on GitHub ↗
(errorCode, lastStreamID)

Source from the content-addressed store, hash-verified

8663 }
8664 __name(onHttp2SessionEnd, "onHttp2SessionEnd");
8665 function onHttp2SessionGoAway(errorCode, lastStreamID) {
8666 if (this[kReceivedGoAway]) {
8667 return;
8668 }
8669 this[kReceivedGoAway] = true;
8670 const err = getGoAwayError(this, errorCode);
8671 const client = this[kClient];
8672 const previousPendingIdx = client[kPendingIdx];
8673 const pendingIdx = getGoAwayPendingIdx(client, lastStreamID);
8674 const retriableRequests = [];
8675 for (let i = pendingIdx; i < previousPendingIdx; i++) {
8676 const request = client[kQueue][i];
8677 if (request != null) {
8678 closeRequestStream(request);
8679 if (canRetryRequestAfterGoAway(request)) {
8680 retriableRequests.push(request);
8681 } else {
8682 util.errorRequest(client, request, err);
8683 }
8684 }
8685 }
8686 if (pendingIdx !== previousPendingIdx) {
8687 const remainingPendingRequests = client[kQueue].slice(previousPendingIdx);
8688 client[kQueue].length = pendingIdx;
8689 client[kQueue].push(...retriableRequests, ...remainingPendingRequests);
8690 }
8691 if (client[kHTTP2Session] === this) {
8692 client[kSocket] = null;
8693 client[kHTTPContext] = null;
8694 client[kHTTP2Session] = null;
8695 }
8696 clearHttp2IdleTimeout(this);
8697 if (!this.closed && !this.destroyed) {
8698 this.close();
8699 }
8700 client[kPendingIdx] = pendingIdx;
8701 client.emit("disconnect", client[kUrl], [client], err);
8702 client[kResume]();
8703 }
8704 __name(onHttp2SessionGoAway, "onHttp2SessionGoAway");
8705 function onHttp2SessionClose() {
8706 const { [kClient]: client, [kHTTP2SessionState]: state, [kSocket]: socket } = this;

Callers

nothing calls this directly

Calls 9

getGoAwayErrorFunction · 0.70
getGoAwayPendingIdxFunction · 0.70
closeRequestStreamFunction · 0.70
clearHttp2IdleTimeoutFunction · 0.70
sliceMethod · 0.65
closeMethod · 0.65
pushMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected