C3: add a read timeout and message-size limits to the Binance stream
connect() used connect_async with no WebSocketConfig and next_event awaited the socket with no deadline, so a stalled server hung the feed forever and an oversized message could force an unbounded allocation. connect() now passes a WebSocketConfig capping message/frame size, and next_event wraps the read in a 300s tokio timeout (well above Binance's ~3-minute ping), surfacing a stall as the new Error::Timeout.
This commit is contained in:
@@ -20,6 +20,10 @@ pub enum Error {
|
||||
#[error("malformed payload: {0}")]
|
||||
Malformed(String),
|
||||
|
||||
/// A live-feed read exceeded its deadline.
|
||||
#[error("read timed out")]
|
||||
Timeout,
|
||||
|
||||
#[cfg(feature = "live-binance")]
|
||||
#[error("websocket error: {0}")]
|
||||
WebSocket(#[from] tokio_tungstenite::tungstenite::Error),
|
||||
|
||||
Reference in New Issue
Block a user