udp: fix some config feature issues

This commit is contained in:
Joakim Frostegård 2021-11-14 03:28:41 +01:00
parent d18117595e
commit 1e9376302d
2 changed files with 9 additions and 9 deletions

View file

@ -18,9 +18,9 @@ pub struct Config {
pub log_level: LogLevel, pub log_level: LogLevel,
pub network: NetworkConfig, pub network: NetworkConfig,
pub protocol: ProtocolConfig, pub protocol: ProtocolConfig,
#[cfg(feature = "with-mio")] #[cfg(any(feature = "with-mio", feature = "with-io-uring"))]
pub handlers: HandlerConfig, pub handlers: HandlerConfig,
#[cfg(feature = "with-mio")] #[cfg(any(feature = "with-mio", feature = "with-io-uring"))]
pub statistics: StatisticsConfig, pub statistics: StatisticsConfig,
pub cleaning: CleaningConfig, pub cleaning: CleaningConfig,
pub privileges: PrivilegeConfig, pub privileges: PrivilegeConfig,
@ -70,7 +70,7 @@ pub struct ProtocolConfig {
pub peer_announce_interval: i32, pub peer_announce_interval: i32,
} }
#[cfg(feature = "with-mio")] #[cfg(any(feature = "with-mio", feature = "with-io-uring"))]
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(default)] #[serde(default)]
pub struct HandlerConfig { pub struct HandlerConfig {
@ -80,7 +80,7 @@ pub struct HandlerConfig {
pub channel_recv_timeout_microseconds: u64, pub channel_recv_timeout_microseconds: u64,
} }
#[cfg(feature = "with-mio")] #[cfg(any(feature = "with-mio", feature = "with-io-uring"))]
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(default)] #[serde(default)]
pub struct StatisticsConfig { pub struct StatisticsConfig {
@ -109,9 +109,9 @@ impl Default for Config {
log_level: LogLevel::Error, log_level: LogLevel::Error,
network: NetworkConfig::default(), network: NetworkConfig::default(),
protocol: ProtocolConfig::default(), protocol: ProtocolConfig::default(),
#[cfg(feature = "with-mio")] #[cfg(any(feature = "with-mio", feature = "with-io-uring"))]
handlers: HandlerConfig::default(), handlers: HandlerConfig::default(),
#[cfg(feature = "with-mio")] #[cfg(any(feature = "with-mio", feature = "with-io-uring"))]
statistics: StatisticsConfig::default(), statistics: StatisticsConfig::default(),
cleaning: CleaningConfig::default(), cleaning: CleaningConfig::default(),
privileges: PrivilegeConfig::default(), privileges: PrivilegeConfig::default(),
@ -143,7 +143,7 @@ impl Default for ProtocolConfig {
} }
} }
#[cfg(feature = "with-mio")] #[cfg(any(feature = "with-mio", feature = "with-io-uring"))]
impl Default for HandlerConfig { impl Default for HandlerConfig {
fn default() -> Self { fn default() -> Self {
Self { Self {
@ -153,7 +153,7 @@ impl Default for HandlerConfig {
} }
} }
#[cfg(feature = "with-mio")] #[cfg(any(feature = "with-mio", feature = "with-io-uring"))]
impl Default for StatisticsConfig { impl Default for StatisticsConfig {
fn default() -> Self { fn default() -> Self {
Self { interval: 0 } Self { interval: 0 }

View file

@ -4,7 +4,7 @@ pub mod common;
pub mod config; pub mod config;
#[cfg(all(feature = "with-glommio", target_os = "linux"))] #[cfg(all(feature = "with-glommio", target_os = "linux"))]
pub mod glommio; pub mod glommio;
#[cfg(feature = "with-mio")] #[cfg(any(feature = "with-mio", feature = "with-io-uring"))]
pub mod other; pub mod other;
use config::Config; use config::Config;