fixed tick bombs
This commit is contained in:
parent
e06f70aed6
commit
158c7d90d8
3
game.go
3
game.go
@ -74,6 +74,7 @@ func NewGame(id string, width, height float64) *game {
|
||||
func (g *game) run() {
|
||||
var t0, t1 time.Time
|
||||
payload := NewBoardstate()
|
||||
ticker := time.NewTicker(time.Duration(*tick) * time.Millisecond)
|
||||
for {
|
||||
select {
|
||||
case <-g.kill:
|
||||
@ -95,7 +96,7 @@ func (g *game) run() {
|
||||
case s := <-g.sunregister:
|
||||
delete(g.spectators, s)
|
||||
close(s.send)
|
||||
case <-time.Tick(time.Duration(*tick) * time.Millisecond):
|
||||
case <-ticker.C:
|
||||
// XXX: This is very racy!! It was at bottom of loop and empty
|
||||
// stuff was going out
|
||||
payload.EmptySlices()
|
||||
|
Loading…
Reference in New Issue
Block a user