don't hydrate client if user is disconnected
This commit is contained in:
parent
53b6d63f3d
commit
d0ac4bb93b
1 changed files with 18 additions and 6 deletions
|
@ -177,14 +177,26 @@ impl UserHandler {
|
|||
.insert(addr, new_user.clone());
|
||||
|
||||
// Hydrate client
|
||||
let tx = self.state.tx_game_handler.clone();
|
||||
let msg = GameHandlerMessage::BroadcastGamesUpdate();
|
||||
tokio::spawn(async move { tx.send(msg).await });
|
||||
let msg = GameHandlerMessage::SendCardPacks(dm_tx.clone());
|
||||
if let Err(e) = self.state.tx_game_handler.send(msg).await {
|
||||
if !dm_tx.is_closed() {
|
||||
if let Err(e) = self
|
||||
.state
|
||||
.tx_game_handler
|
||||
.send(GameHandlerMessage::BroadcastGamesUpdate())
|
||||
.await
|
||||
{
|
||||
tracing::error!("Error contacing game handler {}", e)
|
||||
}
|
||||
|
||||
if let Err(e) = self
|
||||
.state
|
||||
.tx_game_handler
|
||||
.send(GameHandlerMessage::SendCardPacks(dm_tx.clone()))
|
||||
.await
|
||||
{
|
||||
tracing::error!("Error contacing game handler {}", e)
|
||||
}
|
||||
}
|
||||
|
||||
// Broadcast new user's existence
|
||||
// TODO: this should probably be combined and sent as one
|
||||
let tx = self.state.tx_broadcast.clone();
|
||||
|
|
Loading…
Add table
Reference in a new issue