pub struct IoConfig { /* private fields */ }Expand description
Base io configuration
Implementations§
Source§impl IoConfig
impl IoConfig
Sourcepub fn connect_timeout(&self) -> Millis
pub fn connect_timeout(&self) -> Millis
Get connect timeout
Sourcepub fn keepalive_timeout(&self) -> Seconds
pub fn keepalive_timeout(&self) -> Seconds
Get keep-alive timeout
Sourcepub fn disconnect_timeout(&self) -> Seconds
pub fn disconnect_timeout(&self) -> Seconds
Get disconnect timeout
Sourcepub fn frame_read_rate(&self) -> Option<&FrameReadRate>
pub fn frame_read_rate(&self) -> Option<&FrameReadRate>
Get frame read params
Sourcepub fn write_page_size(&self) -> BytePageSize
pub fn write_page_size(&self) -> BytePageSize
Get write page size
Sourcepub fn write_buf_threshold(&self) -> usize
pub fn write_buf_threshold(&self) -> usize
The write buffer threshold that triggers earlier sending.
Sourcepub fn set_connect_timeout<T>(self, timeout: T) -> IoConfig
pub fn set_connect_timeout<T>(self, timeout: T) -> IoConfig
Set connect timeout in seconds.
To disable timeout set value to 0.
By default connect timeout is disabled.
Sourcepub fn set_keepalive_timeout<T>(self, timeout: T) -> IoConfig
pub fn set_keepalive_timeout<T>(self, timeout: T) -> IoConfig
Set keep-alive timeout in seconds.
To disable timeout set value to 0.
By default keep-alive timeout is disabled.
Sourcepub fn set_disconnect_timeout<T>(self, timeout: T) -> IoConfig
pub fn set_disconnect_timeout<T>(self, timeout: T) -> IoConfig
Set connection disconnect timeout.
Defines a timeout for disconnect connection. If a disconnect procedure does not complete within this time, the connection get dropped.
To disable timeout set value to 0.
By default disconnect timeout is set to 1 seconds.
Sourcepub fn set_frame_read_rate(
self,
timeout: Seconds,
max_timeout: Seconds,
rate: u32,
) -> IoConfig
pub fn set_frame_read_rate( self, timeout: Seconds, max_timeout: Seconds, rate: u32, ) -> IoConfig
Set read rate parameters for single frame.
Set read timeout, max timeout and rate for reading payload. If the client
sends rate amount of data within timeout period of time, extend timeout by timeout seconds.
But no more than max_timeout timeout.
By default frame read rate is disabled.
Sourcepub fn set_read_buf(
self,
high_watermark: usize,
low_watermark: usize,
cache_size: usize,
) -> IoConfig
pub fn set_read_buf( self, high_watermark: usize, low_watermark: usize, cache_size: usize, ) -> IoConfig
Set read buffer parameters.
By default high watermark is set to 16Kb, low watermark 1kb.
Sourcepub fn set_write_page_size(self, size: BytePageSize) -> IoConfig
pub fn set_write_page_size(self, size: BytePageSize) -> IoConfig
Set write buffer page size.
By default page size is set to 16kb.
Sourcepub fn set_write_buf_threshold(self, size: usize) -> IoConfig
pub fn set_write_buf_threshold(self, size: usize) -> IoConfig
Sets the write buffer threshold.
The app encodes data in response to incoming data, continuing to fill the write buffer until all data has been processed. Only then can the runtime wake the write task to send the buffered data.
By that time, the buffer may have accumulated a large amount of data, causing it to be sent in large bursts, which introduces latency. To prevent this behavior and flatten data delivery to the peer, ntex’s io can initiate out-of-order writes based on a configured threshold.
Set 0 to disable send-buf.