udp: improve config docs and key order

This commit is contained in:
Joakim Frostegård 2024-02-10 21:48:55 +01:00
parent ebf4ecbf6a
commit b1908329e5

View file

@ -11,7 +11,7 @@ use aquatic_toml_config::TomlConfig;
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize, Serialize)] #[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize, Serialize)]
#[serde(default, deny_unknown_fields)] #[serde(default, deny_unknown_fields)]
pub struct Config { pub struct Config {
/// Number of socket worker. One per virtual CPU is recommended /// Number of socket workers. One per virtual CPU is recommended
pub socket_workers: usize, pub socket_workers: usize,
pub log_level: LogLevel, pub log_level: LogLevel,
pub network: NetworkConfig, pub network: NetworkConfig,
@ -71,13 +71,6 @@ pub struct NetworkConfig {
pub socket_recv_buffer_size: usize, pub socket_recv_buffer_size: usize,
/// Poll timeout in milliseconds (mio backend only) /// Poll timeout in milliseconds (mio backend only)
pub poll_timeout_ms: u64, pub poll_timeout_ms: u64,
#[cfg(feature = "io-uring")]
pub use_io_uring: bool,
/// Number of ring entries (io_uring backend only)
///
/// Will be rounded to next power of two if not already one.
#[cfg(feature = "io-uring")]
pub ring_size: u16,
/// Store this many responses at most for retrying (once) on send failure /// Store this many responses at most for retrying (once) on send failure
/// (mio backend only) /// (mio backend only)
/// ///
@ -85,6 +78,13 @@ pub struct NetworkConfig {
/// such as FreeBSD. Setting the value to zero disables resending /// such as FreeBSD. Setting the value to zero disables resending
/// functionality. /// functionality.
pub resend_buffer_max_len: usize, pub resend_buffer_max_len: usize,
#[cfg(feature = "io-uring")]
pub use_io_uring: bool,
/// Number of ring entries (io_uring backend only)
///
/// Will be rounded to next power of two if not already one.
#[cfg(feature = "io-uring")]
pub ring_size: u16,
} }
impl NetworkConfig { impl NetworkConfig {
@ -103,11 +103,11 @@ impl Default for NetworkConfig {
only_ipv6: false, only_ipv6: false,
socket_recv_buffer_size: 8_000_000, socket_recv_buffer_size: 8_000_000,
poll_timeout_ms: 50, poll_timeout_ms: 50,
resend_buffer_max_len: 0,
#[cfg(feature = "io-uring")] #[cfg(feature = "io-uring")]
use_io_uring: true, use_io_uring: true,
#[cfg(feature = "io-uring")] #[cfg(feature = "io-uring")]
ring_size: 128, ring_size: 128,
resend_buffer_max_len: 0,
} }
} }
} }