mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 18:25:30 +00:00
WIP: ws: split into features, other fixes
This commit is contained in:
parent
465cf5920d
commit
2bed6ccdc5
10 changed files with 76 additions and 25 deletions
|
|
@ -1,11 +1,14 @@
|
|||
use aquatic_common::access_list::update_access_list;
|
||||
use cfg_if::cfg_if;
|
||||
use signal_hook::{consts::SIGUSR1, iterator::Signals};
|
||||
|
||||
use crate::config::Config;
|
||||
|
||||
pub mod common;
|
||||
pub mod config;
|
||||
#[cfg(feature = "with-glommio")]
|
||||
pub mod glommio;
|
||||
#[cfg(feature = "with-mio")]
|
||||
pub mod mio;
|
||||
|
||||
pub const APP_NAME: &str = "aquatic_ws: WebTorrent tracker";
|
||||
|
|
@ -17,7 +20,13 @@ pub fn run(config: Config) -> ::anyhow::Result<()> {
|
|||
});
|
||||
}
|
||||
|
||||
let state = glommio::common::State::default();
|
||||
cfg_if!(
|
||||
if #[cfg(feature = "with-glommio")] {
|
||||
let state = glommio::common::State::default();
|
||||
} else {
|
||||
let state = mio::common::State::default();
|
||||
}
|
||||
);
|
||||
|
||||
update_access_list(&config.access_list, &state.access_list)?;
|
||||
|
||||
|
|
@ -27,7 +36,13 @@ pub fn run(config: Config) -> ::anyhow::Result<()> {
|
|||
let config = config.clone();
|
||||
let state = state.clone();
|
||||
|
||||
::std::thread::spawn(move || glommio::run_inner(config, state));
|
||||
cfg_if!(
|
||||
if #[cfg(feature = "with-glommio")] {
|
||||
::std::thread::spawn(move || glommio::run_inner(config, state));
|
||||
} else {
|
||||
::std::thread::spawn(move || mio::run(config, state));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
for signal in &mut signals {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue