MCPcopy Create free account
hub / github.com/Hidden-Node/GooseRelayVPN-AndroidClient / runStatsLoop

Method runStatsLoop

internal/carrier/stats.go:19–30  ·  view source on GitHub ↗

runStatsLoop periodically emits a one-line summary of carrier health so a developer can spot drift (rising RST count, blacklisted endpoints, etc.) without grepping for individual events. Returns when ctx is canceled.

(ctx context.Context)

Source from the content-addressed store, hash-verified

17// developer can spot drift (rising RST count, blacklisted endpoints, etc.)
18// without grepping for individual events. Returns when ctx is canceled.
19func (c *Client) runStatsLoop(ctx context.Context) {
20 t := time.NewTicker(statsInterval)
21 defer t.Stop()
22 for {
23 select {
24 case <-ctx.Done():
25 return
26 case <-t.C:
27 c.logStats()
28 }
29 }
30}
31
32func (c *Client) logStats() {
33 c.mu.Lock()

Callers 1

RunMethod · 0.95

Calls 2

logStatsMethod · 0.95
StopMethod · 0.45

Tested by

no test coverage detected