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

change global sub to ClientInfo, remove ip output

This commit is contained in:
Kane York 2015-11-18 09:07:34 -08:00
parent 3802dea35c
commit 00175cad39
4 changed files with 57 additions and 18 deletions

View file

@ -353,13 +353,16 @@ func getDeadline() time.Time {
}
func CloseConnection(conn *websocket.Conn, closeMsg websocket.CloseError) {
Statistics.DisconnectCodes[strconv.Itoa(closeMsg.Code)]++
closeTxt := closeMsg.Text
if strings.Contains(closeTxt, "read: connection reset by peer") {
closeTxt = "read: connection reset by peer"
} else if strings.Contains(closeTxt, "use of closed network connection") {
closeTxt = "read: use of closed network connection"
} else if closeMsg.Code == 1001 {
closeTxt = "clean shutdown"
}
// todo kibana cannot analyze these
Statistics.DisconnectCodes[strconv.Itoa(closeMsg.Code)]++
Statistics.DisconnectReasons[closeTxt]++
conn.WriteControl(websocket.CloseMessage, websocket.FormatCloseMessage(closeMsg.Code, closeMsg.Text), getDeadline())