mirror of
https://git.alemi.dev/mumble-stats-api.git
synced 2024-11-22 16:04:49 +01:00
fix: send cloned user
wasteful but eh prototype!
This commit is contained in:
parent
51b6d8c301
commit
425fa62213
1 changed files with 3 additions and 2 deletions
|
@ -136,11 +136,12 @@ impl Session {
|
||||||
Ok(proto::Packet::UserState(user)) => {
|
Ok(proto::Packet::UserState(user)) => {
|
||||||
tracing::info!("user state: {:?}", user);
|
tracing::info!("user state: {:?}", user);
|
||||||
let mut users = session.users.write().await;
|
let mut users = session.users.write().await;
|
||||||
match users.get_mut(&user.session()) {
|
let id = user.session();
|
||||||
|
match users.get_mut(&id) {
|
||||||
Some(u) => u.update(user),
|
Some(u) => u.update(user),
|
||||||
None => { users.insert(user.session(), User::from(user)); },
|
None => { users.insert(user.session(), User::from(user)); },
|
||||||
}
|
}
|
||||||
let _ = session.events.send(users.get(&user.session()).expect("just inserted")); // if it fails nobody is listening
|
let _ = session.events.send(users.get(&id).cloned().expect("just inserted")); // if it fails nobody is listening
|
||||||
},
|
},
|
||||||
Ok(pkt) => tracing::info!("ignoring packet {:?}", pkt),
|
Ok(pkt) => tracing::info!("ignoring packet {:?}", pkt),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue