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

View file

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