From 48ea48d881bc8d8be04a6995fb23052b6a3ed665 Mon Sep 17 00:00:00 2001 From: rasul Date: Sat, 4 Apr 2020 15:27:39 -0500 Subject: [PATCH] Put client token back into the tokens queue to reuse if client is gone --- src/game/state/login.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/game/state/login.rs b/src/game/state/login.rs index 38f0710..640f0f2 100644 --- a/src/game/state/login.rs +++ b/src/game/state/login.rs @@ -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) { - client - } else { - warn!("Can't find a client with token: {:?}", &token); - return send_queue; - } + + let mut client = if let Some(client) = self.clients.remove(&token) { + client + } else { + warn!("Can't find a client with token: {:?}", &token); + self.tokens.push_back(token); + return send_queue }; match state {