mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
fix(analytic):client closed error in windows
This commit is contained in:
parent
5911462f90
commit
d73ee1f035
1 changed files with 6 additions and 0 deletions
|
@ -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,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue