fix: Proxy closing listener with 0 connections left (#4389)

* fix: Proxy closing listener with 0 connections left

A bug was introduced in `0.15.0` where sessions with max connection counts were closed when the connections left hit 0. This issue was highlighted by a user: https://github.com/hashicorp/boundary/issues/4364. What was happening was when we have zero connections left the proxy code was closing the listener which closed its connections

To fix this:
- `boundary connect  -target-id=xx -host-id=xx` command with no connections left will now wait for all connections to be closed and before exiting the session just like it did in `0.14.3`
- As soon as there are no more connections left, the listener will close to stop accepting new connections
- Fix issue where the websocket connection was throwing closing errors during the session teardown.
This commit is contained in:
Elim Tsiagbey authored and GitHub committed 2024-02-09 18:15:00 -05:00
1 parent a7b9916691
commit 1b1c8b3bf9
3 files changed
+17 -1

No files matched your search

+1
View File
@@ -66,6 +66,7 @@ func (p *ClientProxy) sendSessionTeardown(ctx context.Context) error {
if err := wspb.Write(ctx, wsConn, &handshake); err != nil {
return fmt.Errorf("error sending teardown handshake to worker: %w", err)
}
wsConn.Close(websocket.StatusNormalClosure, "session teardown finished")
return nil
}