diff --git a/src/util/telemetry.rs b/src/http.rs similarity index 98% rename from src/util/telemetry.rs rename to src/http.rs index f238978..d860c10 100644 --- a/src/util/telemetry.rs +++ b/src/http.rs @@ -31,7 +31,7 @@ pub async fn launch( rooms: RoomRegistry, storage: Storage, ) -> Result { - log::info!("Starting the telemetry service"); + log::info!("Starting the http service"); let listener = TcpListener::bind(config.listen_on).await?; log::debug!("Listener started"); let terminator = Terminator::spawn(|rx| main_loop(listener, metrics, rooms, storage, rx.map(|_| ()))); @@ -67,7 +67,7 @@ async fn main_loop( }, } } - log::info!("Terminating the telemetry service"); + log::info!("Terminating the http service"); Ok(()) } diff --git a/src/main.rs b/src/main.rs index a7eab22..74e40ed 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -mod util; +mod http; use std::future::Future; use std::path::Path; @@ -16,7 +16,7 @@ use lavina_core::room::RoomRegistry; #[derive(Deserialize, Debug)] struct ServerConfig { - telemetry: util::telemetry::ServerConfig, + telemetry: http::ServerConfig, irc: projection_irc::ServerConfig, xmpp: projection_xmpp::ServerConfig, storage: lavina_core::repo::StorageConfig, @@ -25,7 +25,7 @@ struct ServerConfig { #[derive(Parser)] struct CliArgs { #[arg(long)] - config: Box, + config: Box, } fn load_config() -> Result { @@ -53,9 +53,15 @@ async fn main() -> Result<()> { let storage = Storage::open(storage_config).await?; let rooms = RoomRegistry::new(&mut metrics, storage.clone())?; let mut players = PlayerRegistry::empty(rooms.clone(), &mut metrics)?; - let telemetry_terminator = - util::telemetry::launch(telemetry_config, metrics.clone(), rooms.clone(), storage.clone()).await?; - let irc = projection_irc::launch(irc_config, players.clone(), rooms.clone(), metrics.clone(), storage.clone()).await?; + let telemetry_terminator = http::launch(telemetry_config, metrics.clone(), rooms.clone(), storage.clone()).await?; + let irc = projection_irc::launch( + irc_config, + players.clone(), + rooms.clone(), + metrics.clone(), + storage.clone(), + ) + .await?; let xmpp = projection_xmpp::launch(xmpp_config, players.clone(), rooms.clone(), metrics.clone()).await?; tracing::info!("Started"); diff --git a/src/util/mod.rs b/src/util/mod.rs deleted file mode 100644 index 90e7c7c..0000000 --- a/src/util/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod telemetry; -#[cfg(test)] -pub mod testkit; diff --git a/src/util/testkit.rs b/src/util/testkit.rs deleted file mode 100644 index 59277e0..0000000 --- a/src/util/testkit.rs +++ /dev/null @@ -1,16 +0,0 @@ -use std::task::{Context, Poll}; - -use futures_util::task::noop_waker_ref; - -use lavina_core::prelude::*; - -pub fn sync_future(future: impl Future) -> Result { - let waker = noop_waker_ref(); - let mut context = Context::from_waker(waker); - pin!(future); - if let Poll::Ready(a) = future.poll(&mut context) { - Ok(a) - } else { - Err(anyhow::Error::msg("Future has suspended")) - } -}