Skip to content

Commit

Permalink
Merge pull request #2144 from cjihrig/ws-close
Browse files Browse the repository at this point in the history
websocket: do not close when protocol supports it
  • Loading branch information
k8s-ci-robot authored Jan 8, 2025
2 parents 47f1bf4 + 5de6593 commit 42e5a7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/web-socket-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export class WebSocketHandler implements WebSocketInterface {
buff.writeUint8(this.CloseStream, 0);
buff.writeUint8(this.StdinStream, 1);
ws.send(buff);
return;
}
ws.close();
});
Expand Down
6 changes: 4 additions & 2 deletions src/web-socket-handler_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,10 @@ describe('V5 protocol support', () => {
send: (data) => {
sent = data;
},
close: () => {},
} as WebSocket;
close: () => {
throw new Error('should not be called');
},
} as unknown as WebSocket;
const stdinStream = new ReadableStreamBuffer();
WebSocketHandler.handleStandardInput(ws, stdinStream);
stdinStream.emit('end');
Expand Down

0 comments on commit 42e5a7c

Please sign in to comment.