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

Function once

graph-ui/tools/lib/socket-sampler.mjs:102–129  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

100 const started = Date.now();
101
102 const once = async () => {
103 const pids = await processTree(rootPid);
104 state.maxProcessTreeSize = Math.max(state.maxProcessTreeSize, pids.length);
105 const { lines, error } = await sockets(pids);
106 if (error !== null) {
107 state.lsofErrors += 1;
108 }
109 state.samples += 1;
110 for (const line of lines) {
111 const socket = classifyLine(line);
112 if (socket === null) {
113 continue;
114 }
115 if (socket.loopback) {
116 const key = `${socket.protocol} ${socket.remote}`;
117 state.loopback.set(key, (state.loopback.get(key) ?? 0) + 1);
118 continue;
119 }
120 state.violations.push({
121 atMs: Date.now() - started,
122 protocol: socket.protocol,
123 command: socket.command,
124 pid: socket.pid,
125 local: socket.local,
126 remote: socket.remote,
127 });
128 }
129 };
130
131 const loop = (async () => {
132 while (running) {

Callers 2

startSocketSamplerFunction · 0.85
stopFunction · 0.85

Calls 5

classifyLineFunction · 0.90
socketsFunction · 0.85
processTreeFunction · 0.70
getMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected