diff --git a/server/src/message_handler.rs b/server/src/message_handler.rs index 503d001..3959710 100644 --- a/server/src/message_handler.rs +++ b/server/src/message_handler.rs @@ -128,16 +128,6 @@ impl MessageHandler { .name .clone(); - // Send client updates - self.state - .broadcast_tx - .send(meta_server_summary_update(&self.state)) - .unwrap(); - self.state - .broadcast_tx - .send(meta_chat_update(&self.state)) - .unwrap(); - // Announce User left in chat let msg = ChatMessage { text: format!("{0} left.", &user_name), @@ -161,7 +151,6 @@ impl MessageHandler { } // Move user to offline - // This should probably happen first/immediately but moving down here avoids a clone self.state.offline_users.write().unwrap().insert( user_name, self.state @@ -171,5 +160,15 @@ impl MessageHandler { .remove(&addr) .unwrap(), ); + + // Send client updates + self.state + .broadcast_tx + .send(meta_server_summary_update(&self.state)) + .unwrap(); + self.state + .broadcast_tx + .send(meta_chat_update(&self.state)) + .unwrap(); } }