Put delete of game from controller in right place

Added some debugging
This commit is contained in:
sm
2014-03-31 23:21:16 -07:00
parent c8efd34080
commit 81beee8b43
5 changed files with 15 additions and 11 deletions
+3
View File
@@ -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) {