| 140 | |
| 141 | return { |
| 142 | async stop() { |
| 143 | running = false; |
| 144 | await loop; |
| 145 | await once(); |
| 146 | return { |
| 147 | samples: state.samples, |
| 148 | intervalMs, |
| 149 | durationMs: Date.now() - started, |
| 150 | maxProcessTreeSize: state.maxProcessTreeSize, |
| 151 | lsofErrors: state.lsofErrors, |
| 152 | outboundViolations: state.violations.length, |
| 153 | violations: state.violations, |
| 154 | loopbackConnections: [...state.loopback.entries()] |
| 155 | .map(([endpoint, seen]) => ({ endpoint, seen })) |
| 156 | .sort((a, b) => a.endpoint.localeCompare(b.endpoint)), |
| 157 | }; |
| 158 | }, |
| 159 | get samples() { |
| 160 | return state.samples; |
| 161 | }, |