Put delete of game from controller in right place
Added some debugging
This commit is contained in:
@@ -178,6 +178,7 @@ func (c *Controller) BW(w http.ResponseWriter, req *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// StopGame is the only mechanism to decrease the number of running games in a Controller
|
||||
func (c *Controller) StopGame(w http.ResponseWriter, req *http.Request) {
|
||||
key, err := c.getGameId(req.URL.Path)
|
||||
if err != nil {
|
||||
@@ -193,6 +194,7 @@ func (c *Controller) StopGame(w http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
g.kill <- true
|
||||
delete(c.Games.M, key)
|
||||
message := struct {
|
||||
Ok bool `json:"ok"`
|
||||
Message string `json:"message"`
|
||||
@@ -203,6 +205,7 @@ func (c *Controller) StopGame(w http.ResponseWriter, req *http.Request) {
|
||||
if err := json.NewEncoder(w).Encode(message); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
log.Printf("returning from StopGame")
|
||||
}
|
||||
|
||||
func (c *Controller) KillServer(w http.ResponseWriter, req *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user