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

Method runStatsLoop

internal/exit/stats.go:17–28  ·  view source on GitHub ↗

runStatsLoop emits a one-line health summary every statsInterval until ctx is canceled. Cheap (atomic Loads + one log line) so it's safe to keep always-on.

(ctx context.Context)

Source from the content-addressed store, hash-verified

15// ctx is canceled. Cheap (atomic Loads + one log line) so it's safe to keep
16// always-on.
17func (s *Server) runStatsLoop(ctx context.Context) {
18 t := time.NewTicker(statsInterval)
19 defer t.Stop()
20 for {
21 select {
22 case <-ctx.Done():
23 return
24 case <-t.C:
25 s.logStats()
26 }
27 }
28}
29
30func (s *Server) logStats() {
31 s.mu.Lock()

Callers 1

ListenAndServeMethod · 0.95

Calls 2

logStatsMethod · 0.95
StopMethod · 0.45

Tested by

no test coverage detected