mirror of
https://github.com/szymon-jozef/checkers.git
synced 2026-10-27 19:20:44 +01:00
fix: not sending rejection message
This commit is contained in:
@@ -137,8 +137,19 @@ impl Server {
|
|||||||
self.connections.insert(addr, sender);
|
self.connections.insert(addr, sender);
|
||||||
self.request_handshake(addr).await;
|
self.request_handshake(addr).await;
|
||||||
} else {
|
} else {
|
||||||
let msg = Message::new(ServerMessage::DeclineHandshake { reason: "There is currently game going and it doesn't allow spectators".to_string() });
|
let reason = "There is currently game going and it doesn't allow spectators".to_string();
|
||||||
self.send_message(addr, msg).await;
|
info!("Rejecting {}, because {}", addr, reason);
|
||||||
|
|
||||||
|
let msg = Message::new(ServerMessage::DeclineHandshake { reason: reason });
|
||||||
|
|
||||||
|
|
||||||
|
if let Ok(msg) = msg {
|
||||||
|
let _ = sender.send(msg).await; // we can't use send_message because we
|
||||||
|
// don't add addr to connections
|
||||||
|
} else {
|
||||||
|
warn!("Could not send reason of rejection. Server is acting like my ex...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
warn!("Welcoming reciever closed!");
|
warn!("Welcoming reciever closed!");
|
||||||
|
|||||||
Reference in New Issue
Block a user