Skip to content

Commit

Permalink
Fix tracker results
Browse files Browse the repository at this point in the history
  • Loading branch information
jhalter committed Oct 6, 2024
1 parent f428cd7 commit 7c00567
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion hotline/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,13 @@ func GetListing(conn io.ReadWriteCloser) ([]ServerRecord, error) {
for {
scanner.Scan()

// Make a new []byte slice and copy the scanner bytes to it. This is critical as the
// scanner re-uses the buffer for subsequent scans.
buf := make([]byte, len(scanner.Bytes()))
copy(buf, scanner.Bytes())

var srv ServerRecord
_, err = srv.Write(scanner.Bytes())
_, err = srv.Write(buf)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 7c00567

Please sign in to comment.