Skip to content

Commit eb2afb6

Browse files
committed
Use new struct for decoding reconnecting pty requests
Decoding a JSON message does not touch omitted (or null) fields so once a message with a resize comes in, every single message from that point will cause a resize. I am not sure if this is an actual problem in practice but at the very least it seems unintentional.
1 parent 418f5ab commit eb2afb6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

agent/reconnectingpty/reconnectingpty.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ func (s *ptyState) waitForStateOrContext(ctx context.Context, state State) (Stat
196196
// until EOF or an error writing to ptty or reading from conn.
197197
func readConnLoop(ctx context.Context, conn net.Conn, ptty pty.PTYCmd, metrics *prometheus.CounterVec, logger slog.Logger) {
198198
decoder := json.NewDecoder(conn)
199-
var req codersdk.ReconnectingPTYRequest
200199
for {
200+
var req codersdk.ReconnectingPTYRequest
201201
err := decoder.Decode(&req)
202202
if xerrors.Is(err, io.EOF) {
203203
return

0 commit comments

Comments
 (0)