mirror of
https://github.com/openai/codex.git
synced 2026-08-23 13:09:46 +00:00
Disable Nagle's algorithm for code-mode WebSockets (#37504)
## Why Code-mode WebSocket connections are latency-sensitive, so buffering small TCP writes can delay request and response traffic. ## What changed - Enable `TCP_NODELAY` on outbound remote-session WebSocket connections. - Enable `TCP_NODELAY` on sockets accepted by the code-mode host, logging a warning if the socket option cannot be set. ## Testing - Add a listener test that connects to the host and verifies the accepted socket has `TCP_NODELAY` enabled. GitOrigin-RevId: e51c781c4b47c6a4ae1c32c93cd79768719a68d9
This commit is contained in:
@@ -656,11 +656,13 @@ async fn connect_websocket_transport(
|
||||
"failed to build code-mode host websocket request: {error}"
|
||||
))
|
||||
})?;
|
||||
let connector = WebSocketConnector::new(http_client_factory).map_err(|error| {
|
||||
ConnectionError::Other(format!(
|
||||
"failed to configure code-mode host websocket TLS: {error}"
|
||||
))
|
||||
})?;
|
||||
let connector = WebSocketConnector::new(http_client_factory)
|
||||
.map_err(|error| {
|
||||
ConnectionError::Other(format!(
|
||||
"failed to configure code-mode host websocket TLS: {error}"
|
||||
))
|
||||
})?
|
||||
.with_tcp_nodelay();
|
||||
let websocket_config = WebSocketConfig::default()
|
||||
.max_frame_size(Some(MAX_WEBSOCKET_FRAME_BYTES))
|
||||
.max_message_size(Some(MAX_WEBSOCKET_FRAME_BYTES));
|
||||
|
||||
Reference in New Issue
Block a user