hopefully fix things
Some checks failed
Build and Test / splatoon (push) Has been cancelled
Build and Test / wii-u-chat (push) Has been cancelled
Build and Test / friends (push) Has been cancelled
Build and Test / super-mario-maker (push) Has been cancelled

This commit is contained in:
Maple 2026-04-28 00:47:50 +02:00
commit 2cbac0b1e5
3 changed files with 6 additions and 1 deletions

View file

@ -11,6 +11,7 @@ pub async fn start_regular_backend() {
//gid_counter: AtomicU32::new(1), //gid_counter: AtomicU32::new(1),
sessions: Default::default(), sessions: Default::default(),
users: Default::default(), users: Default::default(),
users_by_pid: Default::default(),
rv_cid_counter: AtomicU32::new(1), rv_cid_counter: AtomicU32::new(1),
}); });

View file

@ -28,6 +28,7 @@ pub struct MatchmakeManager {
pub sessions: RwLock<HashMap<u32, Arc<Mutex<ExtendedMatchmakeSession>>>>, pub sessions: RwLock<HashMap<u32, Arc<Mutex<ExtendedMatchmakeSession>>>>,
pub rv_cid_counter: AtomicU32, pub rv_cid_counter: AtomicU32,
pub users: RwLock<HashMap<u32, Weak<User>>>, pub users: RwLock<HashMap<u32, Weak<User>>>,
pub users_by_pid: RwLock<HashMap<u32, Weak<User>>>,
} }
impl MatchmakeManager { impl MatchmakeManager {

View file

@ -102,6 +102,9 @@ impl Secure for User {
let mut users = self.matchmake_manager.users.write().await; let mut users = self.matchmake_manager.users.write().await;
users.insert(cid, self.this.clone()); users.insert(cid, self.this.clone());
drop(users); 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?; 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); println!("attempt to reach: {}", recpipent);
let Some(user) = self let Some(user) = self
.matchmake_manager .matchmake_manager
.users .users_by_pid
.read() .read()
.await .await
.get(&recpipent) .get(&recpipent)