From 9d865becb19e7ce870b23c4d96d9127baff44d56 Mon Sep 17 00:00:00 2001 From: Eskil Queseth Date: Wed, 21 Oct 2020 04:05:22 +0200 Subject: minor changes --- mumd/src/network/tcp.rs | 10 +++++----- mumd/src/state.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'mumd') diff --git a/mumd/src/network/tcp.rs b/mumd/src/network/tcp.rs index 7ac0474..c2cb234 100644 --- a/mumd/src/network/tcp.rs +++ b/mumd/src/network/tcp.rs @@ -31,8 +31,8 @@ pub(crate) type TcpEventCallback = Box; #[derive(Debug, Clone, Hash, Eq, PartialEq)] pub enum TcpEvent { - Connected, - Disconnected, + Connected, //fires when the client has connected to a server + Disconnected, //fires when the client has disconnected from a server } pub enum TcpEventData<'a> { @@ -180,7 +180,7 @@ async fn listen( state: Arc>, stream: TcpReceiver, crypt_state_sender: mpsc::Sender, - event_data: Arc>>>, + event_queue: Arc>>>, phase_watcher: watch::Receiver, ) { let crypt_state = Rc::new(RefCell::new(None)); @@ -227,7 +227,7 @@ async fn listen( ) .await; } - if let Some(vec) = event_data.lock().unwrap().get_mut(&TcpEvent::Connected) { + if let Some(vec) = event_queue.lock().unwrap().get_mut(&TcpEvent::Connected) { let old = std::mem::take(vec); for handler in old { handler(&TcpEventData::Connected(&msg)); @@ -290,7 +290,7 @@ async fn listen( } }, || async { - if let Some(vec) = event_data.lock().unwrap().get_mut(&TcpEvent::Disconnected) { + if let Some(vec) = event_queue.lock().unwrap().get_mut(&TcpEvent::Disconnected) { let old = std::mem::take(vec); for handler in old { handler(&TcpEventData::Disconnected); diff --git a/mumd/src/state.rs b/mumd/src/state.rs index 0822de0..1a02068 100644 --- a/mumd/src/state.rs +++ b/mumd/src/state.rs @@ -143,7 +143,7 @@ impl State { accept_invalid_cert, ))) .unwrap(); - (Some(TcpEvent::Connected), Box::new(|e| { + (Some(TcpEvent::Connected), Box::new(|e| { //runs the closure when the client is connected if let Some(TcpEventData::Connected(msg)) = e { Ok(Some(CommandResponse::ServerConnect { welcome_message: if msg.has_welcome_text() { -- cgit v1.2.1