1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-10 00:00:53 +00:00

Fix a data race

This commit is contained in:
Kane York 2015-12-16 11:58:48 -08:00
parent 717acb3e40
commit 405ad22372
3 changed files with 11 additions and 2 deletions

View file

@ -50,8 +50,7 @@ func DispatchC2SCommand(conn *websocket.Conn, client *ClientInfo, msg ClientMess
handler = C2SHandleRemoteCommand
}
Statistics.CommandsIssuedTotal++
Statistics.CommandsIssuedMap[msg.Command]++
CommandCounter <- msg.Command
response, err := callHandler(handler, conn, client, msg)

View file

@ -104,6 +104,7 @@ func SetupServerAndHandle(config *ConfigFile, serveMux *http.ServeMux) {
go bunchCacheJanitor()
go pubsubJanitor()
go aggregateDataSender()
go commandCounter()
go ircConnection()
go shutdownHandler()

View file

@ -59,6 +59,15 @@ type StatsData struct {
// I don't really care.
var Statistics = newStatsData()
var CommandCounter = make(chan Command, 10)
func commandCounter() {
for cmd := range CommandCounter {
Statistics.CommandsIssuedTotal++
Statistics.CommandsIssuedMap[cmd]++
}
}
const StatsDataVersion = 5
const pageSize = 4096