Skip to content

Commit

Permalink
log error and return if websocket conn cant be accepted
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjib committed Feb 4, 2025
1 parent 2fc0e29 commit 23112f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions egress/cmd/egress.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"context"
"fmt"
"io/ioutil"
"net"
"net/http"
"os"
Expand Down Expand Up @@ -35,13 +34,13 @@ func main() {
// XXX: in the process of delivering the cert and key to egress.NewListener, we suboptimally
// cast back and forth between []string and []byte... it's just a byproduct of the API
if certFile != "" && keyFile != "" {
cert, err := ioutil.ReadFile(certFile)
cert, err := os.ReadFile(certFile)
if err != nil {
panic(err)
}
tlsCert = string(cert)

key, err := ioutil.ReadFile(keyFile)
key, err := os.ReadFile(keyFile)
if err != nil {
panic(err)
}
Expand Down
4 changes: 4 additions & 0 deletions egress/egresslib.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ func (l proxyListener) handleWebsocket(w http.ResponseWriter, r *http.Request) {
CompressionMode: websocket.CompressionDisabled,
},
)
if err != nil {
common.Debugf("Error accepting WebSocket connection: %v", err)
return
}

tcpAddr, err := net.ResolveTCPAddr("tcp", r.RemoteAddr)
if err != nil {
Expand Down

0 comments on commit 23112f7

Please sign in to comment.