Skip to content

Commit 096a85e

Browse files
chore: steal CloseRead
1 parent 04a92a4 commit 096a85e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

agent/agentcontainers/api.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,10 @@ func (api *API) watchContainers(rw http.ResponseWriter, r *http.Request) {
561561
return
562562
}
563563

564+
// Here we close the websocket for reading, so that the websocket library will handle pings and
565+
// close frames.
566+
_ = conn.CloseRead(context.Background())
567+
564568
ctx, wsNetConn := codersdk.WebsocketNetConn(ctx, conn, websocket.MessageText)
565569
defer wsNetConn.Close()
566570

coderd/workspaceagents.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,10 @@ func (api *API) watchWorkspaceAgentContainers(rw http.ResponseWriter, r *http.Re
873873
return
874874
}
875875

876+
// Here we close the websocket for reading, so that the websocket library will handle pings and
877+
// close frames.
878+
_ = conn.CloseRead(context.Background())
879+
876880
ctx, wsNetConn := codersdk.WebsocketNetConn(ctx, conn, websocket.MessageText)
877881
defer wsNetConn.Close()
878882

0 commit comments

Comments
 (0)