diff --git a/src/main.rs b/src/main.rs index a231e5b..6735b00 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,4 @@ -use std::collections::{HashMap, HashSet}; -use std::marker; +use std::collections::HashMap; use std::time::Instant; use std::{io::Cursor, net::SocketAddr, str::FromStr, sync::Arc, time::Duration}; @@ -25,8 +24,7 @@ struct Client { username: Option, realname: Option, - modes: HashSet, // [byte per mode](https://www.unrealircd.org/docs/User_modes) - + // modes: HashSet, // [byte per mode](https://www.unrealircd.org/docs/User_modes) last_pong: Instant, c2s_tx: Option>, @@ -46,7 +44,7 @@ impl Client { username: None, realname: None, - modes: HashSet::new(), + // modes: HashSet::new(), last_pong: Instant::now(), c2s_tx: Some(c2s_tx), @@ -63,7 +61,7 @@ impl Client { } #[derive(Default, Debug)] -struct AppState { +pub struct AppState { clients: RwLock>, } @@ -96,7 +94,7 @@ impl AppState { &self, peer_addr: SocketAddr, username: &str, - mode: u16, + // mode: u16, realname: Option<&str>, ) { if let Some(client) = self.clients.write().await.get_mut(&peer_addr) { @@ -191,7 +189,7 @@ async fn main() -> Result<()> { let acceptor = TlsAcceptor::from(Arc::new(config)); let listener = TcpListener::bind("0.0.0.0:6697").await?; - // which means, this goes into yet another thread + // Connection loop let state: Arc = app_state.clone(); tokio::spawn(async move { loop { @@ -217,7 +215,7 @@ async fn main() -> Result<()> { } }); - // todo: the "processing" loop goes here... + // Processing loop let state: Arc = app_state.clone(); tokio::spawn(async move { loop { @@ -304,11 +302,11 @@ async fn handle( "USER" => { let mut params = msg.params()?; let username = params.next().unwrap_or_default(); // aviinl - let mode = params.next().unwrap_or_default().parse::()?; // mode - params.next().unwrap_or_default(); // unused + // let mode = params.next().unwrap_or_default().parse::()?; // mode + // params.next().unwrap_or_default(); // unused let realname = msg.trailing()?; // realname - state.user(peer_addr, username, mode, realname).await; + state.user(peer_addr, username, /*mode,*/ realname).await; let nick = state.nick(peer_addr).await.unwrap_or(username.to_string()); state