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

Method connectAnyCandidate

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

Source from the content-addressed store, hash-verified

456 // normal repo pays nothing extra (it connects on the very first probe).
457 const candidates = getDaemonSocketCandidates(root);
458 const connectAnyCandidate = async (): Promise<Awaited<ReturnType<typeof connectWithHello>>> => {
459 for (const candidate of candidates) {
460 const s = await connectWithHello(candidate);
461 // A wrong-version daemon IS up — definitive; propagate so the caller
462 // serves in-process instead of spawning + polling for 6s. Don't keep
463 // probing fallbacks past it.
464 if (s === 'version-mismatch') return s;
465 if (s) return s;
466 }
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();

Callers

nothing calls this directly

Calls 1

connectWithHelloFunction · 0.90

Tested by

no test coverage detected