File tree 1 file changed +4
-18
lines changed
1 file changed +4
-18
lines changed Original file line number Diff line number Diff line change 5
5
"encoding/json"
6
6
"fmt"
7
7
"io"
8
- "net"
9
8
"net/http"
10
9
"net/http/cookiejar"
11
10
"net/url"
@@ -206,14 +205,11 @@ func (c *Client) ConnectRPC(ctx context.Context) (drpc.Conn, error) {
206
205
return nil , codersdk .ReadBodyAsError (res )
207
206
}
208
207
209
- _ , wsNetConn := codersdk .WebsocketNetConn (ctx , conn , websocket .MessageBinary )
208
+ // Set the read limit to 4 MiB -- about the limit for protobufs. This needs to be larger than
209
+ // the default because some of our protocols can include large messages like startup scripts.
210
+ conn .SetReadLimit (1 << 22 )
211
+ netConn := websocket .NetConn (ctx , conn , websocket .MessageBinary )
210
212
211
- netConn := & closeNetConn {
212
- Conn : wsNetConn ,
213
- closeFunc : func () {
214
- _ = conn .Close (websocket .StatusGoingAway , "ConnectRPC closed" )
215
- },
216
- }
217
213
config := yamux .DefaultConfig ()
218
214
config .LogOutput = nil
219
215
config .Logger = slog .Stdlib (ctx , c .SDK .Logger (), slog .LevelInfo )
@@ -618,13 +614,3 @@ func LogsNotifyChannel(agentID uuid.UUID) string {
618
614
type LogsNotifyMessage struct {
619
615
CreatedAfter int64 `json:"created_after"`
620
616
}
621
-
622
- type closeNetConn struct {
623
- net.Conn
624
- closeFunc func ()
625
- }
626
-
627
- func (c * closeNetConn ) Close () error {
628
- c .closeFunc ()
629
- return c .Conn .Close ()
630
- }
You can’t perform that action at this time.
0 commit comments