aboutsummaryrefslogtreecommitdiffstats
path: root/mumd/src/network
diff options
context:
space:
mode:
authorEskil Queseth <eskilq@kth.se>2020-10-21 04:05:22 +0200
committerEskil Queseth <eskilq@kth.se>2020-10-21 04:32:55 +0200
commit9d865becb19e7ce870b23c4d96d9127baff44d56 (patch)
treebff4da473fe4999c0b18eeae1014a42d40d73000 /mumd/src/network
parentc0f24a185ebc270cbaa121cc8ce69ac8ba3f4d30 (diff)
downloadmum-9d865becb19e7ce870b23c4d96d9127baff44d56.tar.gz
minor changes
Diffstat (limited to 'mumd/src/network')
-rw-r--r--mumd/src/network/tcp.rs10
1 files changed, 5 insertions, 5 deletions
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<dyn FnOnce(&TcpEventData)>;
#[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<Mutex<State>>,
stream: TcpReceiver,
crypt_state_sender: mpsc::Sender<ClientCryptState>,
- event_data: Arc<Mutex<HashMap<TcpEvent, Vec<TcpEventCallback>>>>,
+ event_queue: Arc<Mutex<HashMap<TcpEvent, Vec<TcpEventCallback>>>>,
phase_watcher: watch::Receiver<StatePhase>,
) {
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);