aquatic_udp: move code only use in mio impl out of crate::common

This commit is contained in:
Joakim Frostegård 2021-10-21 15:35:21 +02:00
parent 81b7777a4a
commit b10f7b89e7
16 changed files with 89 additions and 71 deletions

View file

@ -1,6 +1,4 @@
use std::sync::Arc;
use aquatic_common::access_list::{AccessListArcSwap, AccessListMode, AccessListQuery};
use cfg_if::cfg_if;
pub mod common;
pub mod config;
@ -13,7 +11,7 @@ use config::Config;
pub const APP_NAME: &str = "aquatic_udp: UDP BitTorrent tracker";
pub fn run(config: Config) -> ::anyhow::Result<()> {
cfg_if::cfg_if! {
cfg_if! {
if #[cfg(all(feature = "with-glommio", target_os = "linux"))] {
glommio::run(config)
} else {
@ -21,14 +19,3 @@ pub fn run(config: Config) -> ::anyhow::Result<()> {
}
}
}
pub fn update_access_list(config: &Config, access_list: &Arc<AccessListArcSwap>) {
match config.access_list.mode {
AccessListMode::White | AccessListMode::Black => {
if let Err(err) = access_list.update_from_path(&config.access_list.path) {
::log::error!("Update access list from path: {:?}", err);
}
}
AccessListMode::Off => {}
}
}