Merge branch 'dev' into feat/self-check

This commit is contained in:
Jacky 2025-01-22 16:22:00 +08:00
commit 6b36f39d96
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D

View file

@ -1,6 +1,7 @@
package helper package helper
import ( import (
"strings"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
"github.com/pkg/errors" "github.com/pkg/errors"
"syscall" "syscall"
@ -15,6 +16,11 @@ func IsUnexpectedWebsocketError(err error) bool {
if errors.Is(err, syscall.EPIPE) { if errors.Is(err, syscall.EPIPE) {
return false return false
} }
// client closed error: *net.OpErr
if strings.Contains(err.Error(), "An existing connection was forcibly closed by the remote host") {
return true
}
return websocket.IsUnexpectedCloseError(err, return websocket.IsUnexpectedCloseError(err,
websocket.CloseGoingAway, websocket.CloseGoingAway,
websocket.CloseNoStatusReceived, websocket.CloseNoStatusReceived,