hopefully fix things
This commit is contained in:
parent
b467dca528
commit
2cbac0b1e5
3 changed files with 6 additions and 1 deletions
|
|
@ -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),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue