MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / findFreePort

Function findFreePort

graph-ui/tools/lib/cbm-server.mjs:45–51  ·  view source on GitHub ↗
(start, taken = [])

Source from the content-addressed store, hash-verified

43
44/** Erster freier Port ab `start`. */
45export async function findFreePort(start, taken = []) {
46 for (let port = start; port < start + 200; port += 1) {
47 if (taken.includes(port)) { continue; }
48 if (await isPortFree(port)) { return port; }
49 }
50 throw new Error(`kein freier Port ab ${start} gefunden`);
51}
52
53/** Wie viele Prozesse auf dem Port lauschen. Null ist das Ziel nach dem Lauf. */
54export async function countListeners(port) {

Callers

nothing calls this directly

Calls 1

isPortFreeFunction · 0.70

Tested by

no test coverage detected