MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / onDaemonLost

Function onDaemonLost

src/mcp/proxy.ts:384–395  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

382 // hang. Instead, fall back to the in-process engine for the rest of the
383 // session and re-serve whatever the dead daemon never answered.
384 const onDaemonLost = (): void => {
385 if (shuttingDown || daemonStatus !== 'ready') return; // host teardown, or already handled
386 daemonStatus = 'failed';
387 try { daemonSocket?.destroy(); } catch { /* ignore */ }
388 daemonSocket = null;
389 process.stderr.write(
390 `[CodeGraph MCP] Shared daemon connection lost; serving this session in-process (degraded), re-serving ${inflight.size} in-flight request(s).\n`
391 );
392 const orphaned = [...inflight.values()];
393 inflight.clear();
394 for (const line of orphaned) void handleLocally(line);
395 };
396 socket.on('close', onDaemonLost);
397 socket.on('error', onDaemonLost);
398 for (const line of pending) {

Callers

nothing calls this directly

Calls 4

handleLocallyFunction · 0.85
destroyMethod · 0.45
writeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected