diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2026-05-28 16:22:24 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2026-05-28 16:22:24 -0700 |
| commit | b772019454ebb804c313e717ae98eb68430e780e (patch) | |
| tree | a12ffc1e5de4d7e1612edaea03174043a6c55784 /hotline/file_wrapper.go | |
| parent | 2f46f87177234070044b5304ca3e0db471699ad8 (diff) | |
Refactor Stats to typed keys and fix peak-tracking race
Replace the map-backed Stats counter with a fixed [numStats]int array
indexed by a new StatKey enum, eliminating the hand-maintained map
initialization and the parallel string-keyed Values() map.
Fix a check-then-act race in the connection peak tracking: the old
Get-then-Set across two lock acquisitions could let concurrent
connections clobber each other's update. The new atomic Max method does
the compare-and-set under a single lock.
Values() now returns a typed StatValues struct whose JSON tags preserve
the existing /api/v1/stats wire format.
Diffstat (limited to 'hotline/file_wrapper.go')
0 files changed, 0 insertions, 0 deletions