MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / severPostMidCall

Function severPostMidCall

e2e/cloud/mcp-priming-reconnect.test.ts:106–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

104 });
105
106 const severPostMidCall = async (): Promise<void> => {
107 await toolCallOpened;
108 await delay(SEVER_GRACE_MS);
109 const hop = toolCallHop;
110 if (!hop) return;
111 // Destroy BOTH ends so every fetch client (undici and bun) observes a hard
112 // stream error: the client-facing response socket (what the SDK's reader is
113 // attached to) AND the upstream to the origin.
114 for (const destroy of [
115 () => hop.res.socket?.destroy(),
116 () => hop.res.destroy(),
117 () => hop.upstream.socket?.destroy(),
118 () => hop.upstream.destroy(),
119 ]) {
120 try {
121 destroy();
122 } catch {
123 /* already gone */
124 }
125 }
126 };
127
128 return new Promise((resolve) => {
129 server.listen(0, "127.0.0.1", () => {

Callers

nothing calls this directly

Calls 3

delayFunction · 0.70
destroyMethod · 0.65
destroyFunction · 0.50

Tested by

no test coverage detected