mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 10:25:52 +02:00
enhance: handle websocket error
This commit is contained in:
parent
7a9aa3a33b
commit
ff1399e044
8 changed files with 126 additions and 60 deletions
|
@ -1,6 +1,7 @@
|
|||
package upstream
|
||||
|
||||
import (
|
||||
"github.com/0xJacky/Nginx-UI/internal/helper"
|
||||
"github.com/0xJacky/Nginx-UI/internal/logger"
|
||||
"github.com/0xJacky/Nginx-UI/internal/upstream"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
@ -35,11 +36,7 @@ func AvailabilityTest(c *gin.Context) {
|
|||
|
||||
for {
|
||||
err = ws.WriteJSON(upstream.AvailabilityTest(body))
|
||||
|
||||
if err != nil || websocket.IsUnexpectedCloseError(err,
|
||||
websocket.CloseGoingAway,
|
||||
websocket.CloseNoStatusReceived,
|
||||
websocket.CloseNormalClosure) {
|
||||
if helper.IsUnexpectedWebsocketError(err) {
|
||||
logger.Error(err)
|
||||
break
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue