mirror of
https://github.com/fiatjaf/khatru.git
synced 2025-04-04 09:58:15 +02:00
better and less logs for websocket abnormal closures.
This commit is contained in:
parent
9684033223
commit
3b7800692f
@ -66,8 +66,12 @@ func handleWebsocket(relay Relay) func(http.ResponseWriter, *http.Request) {
|
||||
typ, message, err := conn.ReadMessage()
|
||||
if err != nil {
|
||||
if websocket.IsUnexpectedCloseError(
|
||||
err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {
|
||||
log.Warn().Err(err).Msg("unexpected close error")
|
||||
err,
|
||||
websocket.CloseGoingAway, // 1001
|
||||
websocket.CloseNoStatusReceived, // 1005
|
||||
websocket.CloseAbnormalClosure, // 1006
|
||||
) {
|
||||
log.Warn().Err(err).Str("ip", r.Header.Get("x-forwarded-for")).Msg("unexpected close error")
|
||||
}
|
||||
break
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user