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

Method getDaemonSocket

src/mcp/index.ts:469–483  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

467 return null;
468 };
469 const getDaemonSocket = async () => {
470 // Fast path: a daemon may already be listening (on either candidate).
471 const probe = await connectAnyCandidate();
472 if (probe === 'version-mismatch') return null; // definitive — serve in-process, don't poll for 6s
473 if (probe) return probe;
474 // None reachable — spawn one (detached) and poll for its bind.
475 spawnDetachedDaemon(root);
476 for (let attempt = 0; attempt < DAEMON_CONNECT_MAX_RETRIES; attempt++) {
477 await sleep(DAEMON_CONNECT_RETRY_DELAY_MS);
478 const s = await connectAnyCandidate();
479 if (s === 'version-mismatch') return null;
480 if (s) return s;
481 }
482 return null; // never bound — the proxy serves this session in-process
483 };
484 await runLocalHandshakeProxy({ getDaemonSocket, makeEngine: () => new MCPEngine(), root });
485 }
486

Callers

nothing calls this directly

Calls 2

spawnDetachedDaemonFunction · 0.85
sleepFunction · 0.70

Tested by

no test coverage detected