Add a message to explain why connection are closed in case of invalid player names

This commit is contained in:
Pierre HUBERT 2022-10-16 20:23:12 +02:00
parent 9a38a634eb
commit 25871de084

View File

@ -152,6 +152,7 @@ impl Actor for HumanPlayerWS {
fn started(&mut self, ctx: &mut Self::Context) { fn started(&mut self, ctx: &mut Self::Context) {
// Check player name length // Check player name length
if self.name.len() < MIN_PLAYER_NAME_LENGTH || self.name.len() > MAX_PLAYER_NAME_LENGTH { if self.name.len() < MIN_PLAYER_NAME_LENGTH || self.name.len() > MAX_PLAYER_NAME_LENGTH {
log::error!("Close connection due to invalid user name!");
ctx.stop(); ctx.stop();
return; return;
} }