summaryrefslogtreecommitdiff
path: root/src/livepos.rs
diff options
context:
space:
mode:
authorstale <redkugelblitzin@gmail.com>2022-07-01 22:14:52 -0300
committerstale <redkugelblitzin@gmail.com>2022-07-01 22:14:52 -0300
commitcc2eb4ef053da7a53663bdecac912a1c49490301 (patch)
tree97d8f153840b342acc7beda290793edc49be1d84 /src/livepos.rs
parentfe851ee7ea31caa48a6d9a8ce1ddbb30854f2321 (diff)
fix the mess i made of type aliases
Diffstat (limited to 'src/livepos.rs')
-rw-r--r--src/livepos.rs5
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 {