aboutsummaryrefslogtreecommitdiff
path: root/server/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/main.rs')
-rw-r--r--server/src/main.rs23
1 files changed, 15 insertions, 8 deletions
diff --git a/server/src/main.rs b/server/src/main.rs
index 3cc6785a..ef397c7d 100644
--- a/server/src/main.rs
+++ b/server/src/main.rs
@@ -159,8 +159,8 @@ async fn run(args: Args) -> anyhow::Result<()> {
let (tx, rx) = broadcast::channel::<PacketC>(128 * 1024);
- let mut state = Server::new(tx).await?;
- state.load(state.index.generate("lobby").await?, None);
+ let mut state = Server::new(tx)?;
+ state.load(state.index.generate_with_book("lobby")?, None);
let state = Arc::new(RwLock::new(state));
#[cfg(feature = "register")]
@@ -197,7 +197,7 @@ async fn run(args: Args) -> anyhow::Result<()> {
let mut tick = interval(Duration::from_secs_f32(dt));
loop {
tick.tick().await;
- if let Err(e) = state.write().await.tick_outer(dt).await {
+ if let Err(e) = state.write().await.tick_outer(dt) {
warn!("Tick failed: {e}");
}
}
@@ -348,19 +348,26 @@ mod test {
#[test]
fn run() {
- harness(async { Server::new(broadcast::channel(1024).0).await.unwrap() });
+ harness(async { Server::new(broadcast::channel(1024).0).unwrap() });
}
#[test]
fn map_load() {
harness(async {
- let mut s = Server::new(broadcast::channel(1024).0).await.unwrap();
- s.load(s.index.generate("lobby").await.unwrap(), None);
+ let mut s = Server::new(broadcast::channel(1024).0).unwrap();
+ s.load(s.index.generate("5star").unwrap(), None);
+ });
+ }
+ #[test]
+ fn map_load_book() {
+ harness(async {
+ let mut s = Server::new(broadcast::channel(1024).0).unwrap();
+ s.load(s.index.generate_with_book("lobby").unwrap(), None);
});
}
#[test]
fn tick() {
harness(async {
- let mut s = Server::new(broadcast::channel(1024).0).await.unwrap();
+ let mut s = Server::new(broadcast::channel(1024).0).unwrap();
for _ in 0..100 {
s.tick(0.1);
}
@@ -369,7 +376,7 @@ mod test {
#[test]
fn packet_sender_verif() {
harness(async {
- let mut s = Server::new(broadcast::channel(1024).0).await.unwrap();
+ let mut s = Server::new(broadcast::channel(1024).0).unwrap();
for (conn, p) in [
PacketS::Effect {