renames
This commit is contained in:
@@ -432,7 +432,7 @@ impl Server {
|
|||||||
|
|
||||||
let _ = send(&tx, "GAME:LOSS");
|
let _ = send(&tx, "GAME:LOSS");
|
||||||
let _ = send(&opponent.connection, "GAME:WINS");
|
let _ = send(&opponent.connection, "GAME:WINS");
|
||||||
self.broadcast_message_all_observers(&format!(
|
self.broadcast(&format!(
|
||||||
"GAME:{}:WIN:{}",
|
"GAME:{}:WIN:{}",
|
||||||
current_match_id, opponent.username
|
current_match_id, opponent.username
|
||||||
))
|
))
|
||||||
@@ -885,7 +885,7 @@ impl Server {
|
|||||||
timeout_thread.abort();
|
timeout_thread.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.broadcast_message_all_observers(&format!("GAME:{}:WIN:{}", match_id, winner_username))
|
self.broadcast(&format!("GAME:{}:WIN:{}", match_id, winner_username))
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let clients_guard = self.clients.read().await;
|
let clients_guard = self.clients.read().await;
|
||||||
@@ -1001,7 +1001,7 @@ impl Server {
|
|||||||
// Clear any pending reservations when a tournament starts
|
// Clear any pending reservations when a tournament starts
|
||||||
self.reservations.write().await.clear();
|
self.reservations.write().await.clear();
|
||||||
|
|
||||||
self.broadcast_message_all_observers(&format!("TOURNAMENT:START:{}", tournament_type))
|
self.broadcast(&format!("TOURNAMENT:START:{}", tournament_type))
|
||||||
.await;
|
.await;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -1020,7 +1020,7 @@ impl Server {
|
|||||||
tourney.write().await.cancel(&self).await;
|
tourney.write().await.cancel(&self).await;
|
||||||
*tournament_guard = None;
|
*tournament_guard = None;
|
||||||
|
|
||||||
self.broadcast_message_all_observers("TOURNAMENT:CANCEL").await;
|
self.broadcast("TOURNAMENT:CANCEL").await;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1228,7 +1228,7 @@ impl Server {
|
|||||||
timeout_thread.abort();
|
timeout_thread.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.broadcast_message_all_observers(&format!("GAME:{}:TERMINATED", match_id)).await;
|
self.broadcast(&format!("GAME:{}:TERMINATED", match_id)).await;
|
||||||
|
|
||||||
let clients_guard = self.clients.read().await;
|
let clients_guard = self.clients.read().await;
|
||||||
if the_match.player1 != SERVER_PLAYER_ADDR.to_string().parse().unwrap() {
|
if the_match.player1 != SERVER_PLAYER_ADDR.to_string().parse().unwrap() {
|
||||||
@@ -1263,7 +1263,7 @@ impl Server {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn broadcast_message_all_observers(&self, msg: &str) {
|
pub async fn broadcast(&self, msg: &str) {
|
||||||
let observers_guard = self.observers.read().await;
|
let observers_guard = self.observers.read().await;
|
||||||
for (_, tx) in observers_guard.iter() {
|
for (_, tx) in observers_guard.iter() {
|
||||||
let _ = send(tx, msg);
|
let _ = send(tx, msg);
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ impl Tournament for RoundRobin {
|
|||||||
}
|
}
|
||||||
message.pop();
|
message.pop();
|
||||||
|
|
||||||
server.broadcast_message_all_observers(&message).await;
|
server.broadcast(&message).await;
|
||||||
|
|
||||||
if self.is_completed() {
|
if self.is_completed() {
|
||||||
// Send scores
|
// Send scores
|
||||||
|
|||||||
Reference in New Issue
Block a user