add handler interface to receive agent worker updates (#2830)

* add handler interface to receive agent worker updates

* cleanup
This commit is contained in:
Paul Wells
2024-07-02 13:11:08 -07:00
committed by GitHub
parent 7dff092285
commit e511464d3d
6 changed files with 343 additions and 285 deletions
+1 -13
View File
@@ -18,12 +18,10 @@ import (
"context"
"errors"
"fmt"
"io"
"math/rand"
"net/http"
"os"
"strconv"
"strings"
"sync"
"time"
@@ -369,17 +367,7 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
for {
req, count, err := sigConn.ReadRequest()
if err != nil {
// normal/expected closure
if errors.Is(err, io.EOF) ||
strings.HasSuffix(err.Error(), "use of closed network connection") ||
strings.HasSuffix(err.Error(), "connection reset by peer") ||
websocket.IsCloseError(
err,
websocket.CloseAbnormalClosure,
websocket.CloseGoingAway,
websocket.CloseNormalClosure,
websocket.CloseNoStatusReceived,
) {
if IsWebSocketCloseError(err) {
closedByClient.Store(true)
} else {
pLogger.Errorw("error reading from websocket", err, "connID", cr.ConnectionID)