]> 127.0.0.1 Git - front/.git/commitdiff
Update ws.go v0.1.20241008081652
authorqydysky <qydysky@foxmail.com>
Tue, 8 Oct 2024 08:15:12 +0000 (16:15 +0800)
committerGitHub <noreply@github.com>
Tue, 8 Oct 2024 08:15:12 +0000 (16:15 +0800)
ws.go

diff --git a/ws.go b/ws.go
index de447dd0b1ef54f6f7bedee3652356355eb318e8..f54fe13bfd5e4626d4409a84f805e9c740733483 100644 (file)
--- a/ws.go
+++ b/ws.go
@@ -71,23 +71,15 @@ func (wsDealer) Deal(ctx context.Context, w http.ResponseWriter, r *http.Request
        if e != nil && !errors.Is(e, context.Canceled) {
                logger.Warn(`W:`, fmt.Sprintf(errFormat, r.RemoteAddr, chosenBack.route.config.Addr, routePath, chosenBack.Name, e, time.Since(opT)))
                chosenBack.Disable()
-               conn = nil
-               resp = nil
+               return ErrResFail
        }
 
        if chosenBack.getErrToSec() != 0 && time.Since(opT).Seconds() > chosenBack.getErrToSec() {
                logger.Warn(`W:`, fmt.Sprintf(errFormat, r.RemoteAddr, chosenBack.route.config.Addr, routePath, chosenBack.Name, ErrResTO, time.Since(opT)))
                chosenBack.Disable()
-               conn.Close()
-               conn = nil
-               resp = nil
        }
        // }
 
-       if resp == nil || conn == nil {
-               return ErrResFail
-       }
-
        if pctx.Done(r.Context()) {
                return context.Canceled
        }