summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index 36ee5ce..9c9e5b1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -55,7 +55,9 @@ async fn tokio_main(conf: Config) -> Result<(), Box<dyn Error>> {
.then(|(id, _):(&RoomId,_)| {
let roomsl = roomsl.clone();
async move {
- (id.clone(), roomsl.get(id).unwrap().read().await.players.read().await.len())
+ let room = roomsl.get(id).unwrap().read().await;
+ let pcount = room.players.read().await.len();
+ (id.clone(), (pcount, room.conf.player_cap))
}
})
.collect::<HashMap<RoomId,_>>().await;
@@ -157,13 +159,13 @@ async fn tokio_main(conf: Config) -> Result<(), Box<dyn Error>> {
let id = RoomId {0: id};
match rooms.read().await.get(&id).map(|x| x.clone()) {
Some(r) => {
- println!("conn from {saddr:?} into {id}");
+ println!("{id} I: conn from {saddr:?}");
Ok(websocket.on_upgrade(move |socket| {
- conn::lobby(socket, saddr.expect("socket without address"), r.clone())
+ conn::lobby(socket, saddr.expect("socket without address"), (id,r.clone()))
}))
},
None => {
- println!("conn from {saddr:?} into inexistent room {id}");
+ println!("I: conn from {saddr:?} into inexistent room {id}");
Err(reject())
}
}