pub struct Config {
pub registry: Arc<Mutex<Registry>>,
pub threads: usize,
pub catch_panics: bool,
pub max_message_size: usize,
pub read_timeout: Duration,
pub write_timeout: Duration,
pub tcp_nodelay: Option<bool>,
}
Expand description
Configuration for the tokio
runtime.
Fields§
§registry: Arc<Mutex<Registry>>
Registry for metrics.
threads: usize
Number of threads to use for the runtime.
catch_panics: bool
Whether or not to catch panics.
max_message_size: usize
Maximum size used for all messages sent over the wire.
We use this to prevent malicious peers from sending us large messages that would consume all of our memory.
If this value is not synchronized across all connected peers, chunks will be parsed incorrectly (any non-terminal chunk must be of ~this size).
Users of this runtime can chunk messages of this size to send over the wire.
read_timeout: Duration
Duration after which to close the connection if no message is read.
write_timeout: Duration
Duration after which to close the connection if a message cannot be written.
tcp_nodelay: Option<bool>
Whether or not to disable Nagle’s algorithm.
The algorithm combines a series of small network packets into a single packet before sending to reduce overhead of sending multiple small packets which might not be efficient on slow, congested networks. However, to do so the algorithm introduces a slight delay as it waits to accumulate more data. Latency-sensitive networks should consider disabling it to send the packets as soon as possible to reduce latency.
Note: Make sure that your compile target has and allows this configuration otherwise panics or unexpected behaviours are possible.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)