Skip to content

Commit

Permalink
Fix: Client websocket connection hangs when server disconnects (#657)
Browse files Browse the repository at this point in the history
```
_, err := io.Copy(src, dst)
```
io.Copy doesn't automatically fail when `src` connection closes. 

This change guarantees that when at least connection fails (either src,
dst) the other one also disconnects
  • Loading branch information
jsun-m authored Oct 24, 2024
1 parent 0041651 commit 694f639
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/abstractions/endpoint/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,11 @@ func (rb *RequestBuffer) proxyWebsocketConnection(r *request, c container, diale
}

func forwardWSConn(src net.Conn, dst net.Conn) {
defer func() {
src.Close()
dst.Close()
}()

_, err := io.Copy(src, dst)
if err != nil {
return
Expand Down

0 comments on commit 694f639

Please sign in to comment.