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

Fix disconnect reason statistics

This commit is contained in:
Kane York 2015-11-16 20:26:59 -08:00
parent c42a0fb171
commit ab14cdac72

View file

@ -316,7 +316,13 @@ func getDeadline() time.Time {
func CloseConnection(conn *websocket.Conn, closeMsg *websocket.CloseError) {
Statistics.DisconnectCodes[strconv.Itoa(closeMsg.Code)]++
Statistics.DisconnectReasons[closeMsg.Text]++
closeTxt := closeMsg.Text
if strings.Contains(closeTxt, "read: connection reset by peer") {
closeTxt = "read: connection reset by peer"
} else if closeMsg.Code == 1001 {
closeTxt = "clean shutdown"
}
Statistics.DisconnectReasons[closeTxt]++
conn.WriteControl(websocket.CloseMessage, websocket.FormatCloseMessage(closeMsg.Code, closeMsg.Text), getDeadline())
conn.Close()