removed goroutine leak
This commit is contained in:
parent
fb0e6d92d7
commit
c6b480fa1e
10
game.go
10
game.go
@ -14,7 +14,6 @@ type game struct {
|
|||||||
splosions map[*bot.Splosion]bool
|
splosions map[*bot.Splosion]bool
|
||||||
register chan *player
|
register chan *player
|
||||||
unregister chan *player
|
unregister chan *player
|
||||||
robot_id chan int
|
|
||||||
turn int
|
turn int
|
||||||
width, height float64
|
width, height float64
|
||||||
spectators map[*Spectator]bool
|
spectators map[*Spectator]bool
|
||||||
@ -39,16 +38,7 @@ func NewGame(id string, width, height float64) *game {
|
|||||||
sunregister: make(chan *Spectator),
|
sunregister: make(chan *Spectator),
|
||||||
kill: make(chan bool, 128),
|
kill: make(chan bool, 128),
|
||||||
}
|
}
|
||||||
|
|
||||||
g.robot_id = make(chan int)
|
|
||||||
go func() {
|
|
||||||
for i := 0; ; i++ {
|
|
||||||
g.robot_id <- i
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
return g
|
return g
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *game) run() {
|
func (g *game) run() {
|
||||||
|
Loading…
Reference in New Issue
Block a user