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)
| 17 | // developer can spot drift (rising RST count, blacklisted endpoints, etc.) |
| 18 | // without grepping for individual events. Returns when ctx is canceled. |
| 19 | func (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 | |
| 32 | func (c *Client) logStats() { |
| 33 | c.mu.Lock() |