add slight optimization
All checks were successful
Build and Test / super-mario-maker (push) Successful in 2m37s
Build and Test / mario-tennis (push) Successful in 2m57s
Build and Test / wii-sports-club (push) Successful in 3m21s
Build and Test / splatoon-testfire (push) Successful in 4m3s
Build and Test / splatoon (push) Successful in 4m29s
Build and Test / friends (push) Successful in 4m57s
Build and Test / puyopuyo (push) Successful in 4m59s
Build and Test / wii-u-chat (push) Successful in 5m35s
Build and Test / sonic-transformed (push) Successful in 6m21s
Build and Test / minecraft-wiiu (push) Successful in 6m41s
Build and Test / fast-racing-neo (push) Successful in 6m47s

This commit is contained in:
Maple Nebel 2026-05-11 15:02:56 +02:00
commit 71d9d8e3a6

View file

@ -128,7 +128,7 @@ fn check_bounds_str<T: FromStr + PartialOrd>(compare: T, str: &str) -> Option<bo
}
pub async fn broadcast_notification<T: AsRef<User>>(
players: &[T],
players: impl Iterator<Item = T>,
notification_event: &NotificationEvent,
) {
for player in players {
@ -142,16 +142,13 @@ pub async fn broadcast_notification<T: AsRef<User>>(
impl ExtendedMatchmakeSession {
#[inline(always)]
pub fn get_active_players(&self) -> Vec<Arc<User>> {
self.connected_players
.iter()
.filter_map(|u| u.upgrade())
.collect()
pub fn get_active_players(&self) -> impl Iterator<Item = Arc<User>> {
self.connected_players.iter().filter_map(|u| u.upgrade())
}
#[inline(always)]
pub async fn broadcast_notification(&self, notification_event: &NotificationEvent) {
broadcast_notification(&self.get_active_players(), notification_event).await;
broadcast_notification(self.get_active_players(), notification_event).await;
}
pub async fn from_matchmake_session(
@ -314,7 +311,6 @@ impl ExtendedMatchmakeSession {
#[inline]
pub fn is_reachable(&self) -> bool {
self.get_active_players()
.iter()
.any(|v| v.pid == self.session.gathering.host_pid)
&& (if self.session.gathering.flags & PERSISTENT_GATHERING != 0 {
if self.has_active_players() {