diff --git a/player.go b/player.go index 1187e9a..f173996 100644 --- a/player.go +++ b/player.go @@ -61,9 +61,8 @@ type player struct { } func (p *player) recv() { - buff := make([]byte, maxMessageSize) for { - msgs, err := p.readJSON(buff) + msgs, err := p.readJSON(p.buff) if err != nil { log.Printf("%s: %s", p.Id, err) break @@ -137,10 +136,8 @@ type Spectator struct { } func (s *Spectator) recv() { - // TODO: move this to a NewSpectator func - buff := make([]byte, maxMessageSize) for { - _, err := s.readJSON(buff) + _, err := s.readJSON(s.buff) if err != nil { log.Printf("%s: %s", s.Id, err) break