Put client token back into the tokens queue to reuse if client is gone

master
rasul 5 years ago
parent dd5f335ef3
commit 48ea48d881

@ -11,13 +11,13 @@ use crate::state::*;
impl Game {
pub fn login(&mut self, token: Token, message: String, state: &Login) -> SendQueue {
let mut send_queue = SendQueue::new();
let mut client = {
if let Some(client) = self.clients.remove(&token) {
let mut client = if let Some(client) = self.clients.remove(&token) {
client
} else {
warn!("Can't find a client with token: {:?}", &token);
return send_queue;
}
self.tokens.push_back(token);
return send_queue
};
match state {

Loading…
Cancel
Save