aboutsummaryrefslogtreecommitdiff
path: root/hotline/tracker.go
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2024-10-06 10:14:31 -0700
committerJeff Halter <868228+jhalter@users.noreply.github.com>2024-10-06 10:14:31 -0700
commit7c005672a40eb92110e32b37f41f59c027fa8598 (patch)
tree6f1173736489fd2e8668f143e32a28e7a4c95051 /hotline/tracker.go
parentf428cd7b08e68d650d4bf669cfc618f5fab998b4 (diff)
Fix tracker results
Diffstat (limited to 'hotline/tracker.go')
-rw-r--r--hotline/tracker.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/hotline/tracker.go b/hotline/tracker.go
index a3e077e..52963bf 100644
--- a/hotline/tracker.go
+++ b/hotline/tracker.go
@@ -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
}