diff --git a/rnex-core/src/executables/regular_backend.rs b/rnex-core/src/executables/regular_backend.rs index 65cb2ca..7f62864 100644 --- a/rnex-core/src/executables/regular_backend.rs +++ b/rnex-core/src/executables/regular_backend.rs @@ -11,6 +11,7 @@ pub async fn start_regular_backend() { //gid_counter: AtomicU32::new(1), sessions: Default::default(), users: Default::default(), + users_by_pid: Default::default(), rv_cid_counter: AtomicU32::new(1), }); diff --git a/rnex-core/src/nex/matchmake.rs b/rnex-core/src/nex/matchmake.rs index 8ab6105..cd172ee 100644 --- a/rnex-core/src/nex/matchmake.rs +++ b/rnex-core/src/nex/matchmake.rs @@ -28,6 +28,7 @@ pub struct MatchmakeManager { pub sessions: RwLock>>>, pub rv_cid_counter: AtomicU32, pub users: RwLock>>, + pub users_by_pid: RwLock>>, } impl MatchmakeManager { diff --git a/rnex-core/src/nex/user.rs b/rnex-core/src/nex/user.rs index c1375a3..781ca7b 100644 --- a/rnex-core/src/nex/user.rs +++ b/rnex-core/src/nex/user.rs @@ -102,6 +102,9 @@ impl Secure for User { let mut users = self.matchmake_manager.users.write().await; users.insert(cid, self.this.clone()); drop(users); + let mut users = self.matchmake_manager.users_by_pid.write().await; + users.insert(self.pid, self.this.clone()); + drop(users); let stations = get_station_urls(&station_urls, self.ip, self.pid, cid).await?; @@ -444,7 +447,7 @@ impl MatchmakeExtension for User { println!("attempt to reach: {}", recpipent); let Some(user) = self .matchmake_manager - .users + .users_by_pid .read() .await .get(&recpipent)