diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2020-10-18 02:30:39 +0200 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2020-10-21 01:07:43 +0200 |
| commit | d9a3470fcb4c8c63dd5fb76dd7f2f7eb977d8b0d (patch) | |
| tree | 5083c6f0e270818eb40b5cd822472ac9218e041e /mumd/src/state.rs | |
| parent | 9f4c05059f1990a23995e3363f88ab753187042d (diff) | |
| download | mum-d9a3470fcb4c8c63dd5fb76dd7f2f7eb977d8b0d.tar.gz | |
implement remove_client
Diffstat (limited to 'mumd/src/state.rs')
| -rw-r--r-- | mumd/src/state.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/mumd/src/state.rs b/mumd/src/state.rs index 494f61f..8dc3d68 100644 --- a/mumd/src/state.rs +++ b/mumd/src/state.rs @@ -204,8 +204,14 @@ impl State { } } - pub fn remove_client(&mut self, session: u32) { - + pub fn remove_client(&mut self, msg: msgs::UserRemove) { + if !msg.has_session() { + warn!("Tried to remove user state without session"); + return; + } + self.audio().remove_client(msg.get_session()); + self.server_mut().unwrap().users_mut().remove(&msg.get_session()); + info!("User {} disconnected", msg.get_session()); } pub fn reload_config(&mut self) { |
