From 1058048a12a5746a50f6d62b999fab8bc91ed3bc Mon Sep 17 00:00:00 2001 From: Maple Date: Thu, 31 Jul 2025 22:00:48 +0200 Subject: [PATCH] fix memory leak --- macros/src/protos.rs | 7 +------ src/nex/matchmake.rs | 4 +++- src/nex/user.rs | 6 ++++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/macros/src/protos.rs b/macros/src/protos.rs index 14ec2f6..fdf8b62 100644 --- a/macros/src/protos.rs +++ b/macros/src/protos.rs @@ -325,10 +325,5 @@ impl ToTokens for RmcProtocolData{ self.generate_raw_trait(tokens); self.generate_raw_info(tokens); self.generate_raw_remote_trait(tokens); - - - - } -} - +} \ No newline at end of file diff --git a/src/nex/matchmake.rs b/src/nex/matchmake.rs index bba55f5..c01c9a7 100644 --- a/src/nex/matchmake.rs +++ b/src/nex/matchmake.rs @@ -50,7 +50,7 @@ impl MatchmakeManager{ async fn garbage_collect(&self){ info!("running rnex garbage collector over all sessions and users"); - let idx = 0; + let mut idx = 0; let mut to_be_deleted_gids = Vec::new(); @@ -69,6 +69,8 @@ impl MatchmakeManager{ if !session.is_reachable(){ to_be_deleted_gids.push(gid); } + + idx += 1; } let mut sessions = self.sessions.write().await; diff --git a/src/nex/user.rs b/src/nex/user.rs index e166a80..d77c289 100644 --- a/src/nex/user.rs +++ b/src/nex/user.rs @@ -269,6 +269,12 @@ impl MatchmakeExtension for User { let session = self.matchmake_manager.get_session(join_session_param.gid).await?; let mut session = session.lock().await; + + if session.session.user_password_enabled{ + if join_session_param.user_password != session.session.user_password{ + return Err(ErrorCode::RendezVous_InvalidPassword) + } + } session.connected_players.retain(|v| v.upgrade().is_some_and(|v| v.pid != self.pid));