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

Function onHttpSocketClose

deps/undici/undici.js:7744–7774  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7742 }
7743 __name(onHttpSocketEnd, "onHttpSocketEnd");
7744 function onHttpSocketClose() {
7745 const parser = this[kParser];
7746 clearIdleSocketValidation(this);
7747 if (parser) {
7748 if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) {
7749 this[kError] = parser.finish() || this[kError];
7750 }
7751 this[kParser].destroy();
7752 this[kParser] = null;
7753 }
7754 const err = this[kError] || new SocketError("closed", util.getSocketInfo(this));
7755 const client = this[kClient];
7756 client[kSocket] = null;
7757 client[kHTTPContext] = null;
7758 if (client.destroyed) {
7759 assert(client[kPending] === 0);
7760 const requests = client[kQueue].splice(client[kRunningIdx]);
7761 for (let i = 0; i < requests.length; i++) {
7762 const request = requests[i];
7763 util.errorRequest(client, request, err);
7764 }
7765 } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") {
7766 const request = client[kQueue][client[kRunningIdx]];
7767 client[kQueue][client[kRunningIdx]++] = null;
7768 util.errorRequest(client, request, err);
7769 }
7770 client[kPendingIdx] = client[kRunningIdx];
7771 assert(client[kRunning] === 0);
7772 client.emit("disconnect", client[kUrl], [client], err);
7773 client[kResume]();
7774 }
7775 __name(onHttpSocketClose, "onHttpSocketClose");
7776 function onSocketClose() {
7777 this[kClosed] = true;

Callers

nothing calls this directly

Calls 5

assertFunction · 0.50
finishMethod · 0.45
destroyMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…