rewrite of the stats system

This commit is contained in:
Fraser Graham
2014-01-16 00:02:59 -08:00
parent 90b7731865
commit 3fa53daadb
7 changed files with 46 additions and 14 deletions
+3 -3
View File
@@ -129,9 +129,9 @@ func gameStats(w http.ResponseWriter, req *http.Request) {
http.Error(w, string(b), http.StatusNotFound)
return
}
g.winners.RLock()
defer g.winners.RUnlock()
if err := json.NewEncoder(w).Encode(g.winners.m); err != nil {
g.stats.RLock()
defer g.stats.RUnlock()
if err := json.NewEncoder(w).Encode(g.stats); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}