diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2025-11-24 16:52:37 -0800 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2025-11-24 16:52:37 -0800 |
| commit | ab16c7d82c8381a4df80fef4b2fe81e7ff23dad8 (patch) | |
| tree | d6f18b989dec7cb88eaad284bb5774744c2ec69d /hotline/stats.go | |
| parent | 357baa94bf9b1d4b623f8a9c04b9d591e9f60406 (diff) | |
Fix tracker server list parsing for batched responses
The tracker protocol splits large server lists into batches, with each
batch preceded by a ServerInfoHeader. Previously, GetListing only read
the initial header and failed when encountering subsequent headers
mid-stream, causing the scanner to misinterpret header bytes as server
record data.
Changes:
- Refactored GetListing to use bufio.Reader instead of bufio.Scanner
to handle heterogeneous data (headers and server records)
- Added readServerRecord helper function for sequential reading
- Renamed ServerInfoHeader.SrvCountDup to BatchSize for clarity
- Added comprehensive documentation explaining the batching protocol
- Removed unused serverScanner function and tests
- Added table tests covering multiple batch scenarios
The BatchSize field indicates the number of servers in the current
batch, while SrvCount indicates the total across all batches.
Diffstat (limited to 'hotline/stats.go')
0 files changed, 0 insertions, 0 deletions