1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-02 16:08:31 +00:00

Fix data race, add stat

This commit is contained in:
Kane York 2015-12-16 12:00:37 -08:00
parent 405ad22372
commit 6b88b40538
2 changed files with 4 additions and 1 deletions

View file

@ -160,6 +160,7 @@ func HTTPHandleRootURL(w http.ResponseWriter, r *http.Request) {
updateSysMem()
if Statistics.SysMemTotalKB-Statistics.SysMemFreeKB < Configuration.MinMemoryKBytes {
atomic.AddUint64(&Statistics.LowMemDroppedConnections, 1)
w.WriteHeader(503)
return
}
@ -439,7 +440,7 @@ func SendMessage(conn *websocket.Conn, msg ClientMessage) {
}
conn.SetWriteDeadline(getDeadline())
conn.WriteMessage(messageType, packet)
Statistics.MessagesSent++
atomic.AddUint64(&Statistics.MessagesSent, 1)
}
// UnmarshalClientMessage unpacks websocket TextMessage into a ClientMessage provided in the `v` parameter.