diff options
author | stale <redkugelblitzin@gmail.com> | 2022-07-01 22:14:52 -0300 |
---|---|---|
committer | stale <redkugelblitzin@gmail.com> | 2022-07-01 22:14:52 -0300 |
commit | cc2eb4ef053da7a53663bdecac912a1c49490301 (patch) | |
tree | 97d8f153840b342acc7beda290793edc49be1d84 /src/livepos.rs | |
parent | fe851ee7ea31caa48a6d9a8ce1ddbb30854f2321 (diff) |
fix the mess i made of type aliases
Diffstat (limited to 'src/livepos.rs')
-rw-r--r-- | src/livepos.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/livepos.rs b/src/livepos.rs index 9112755..b19eda6 100644 --- a/src/livepos.rs +++ b/src/livepos.rs @@ -1,6 +1,7 @@ use crate::types::*; +use std::sync::Arc; use tokio::sync::mpsc as tokio_mpsc; -use tokio::sync::Mutex; +use tokio::sync::{ RwLock, Mutex }; use std::collections::{HashMap,HashSet}; use tokio::time::{self, Duration}; use warp::ws::Message; @@ -16,7 +17,7 @@ pub struct Req { pub data: ReqData, } -pub async fn livepos(players: PlayerMapData, mut recv: tokio_mpsc::UnboundedReceiver<Req>) { +pub async fn livepos(players: Arc<RwLock<PlayerMap>>, mut recv: tokio_mpsc::UnboundedReceiver<Req>) { let positions = Mutex::new(HashMap::new()); let dirty = Mutex::new(HashSet::new()); let process_upds = async { |