diff options
| author | Fuwn <[email protected]> | 2021-03-28 15:08:12 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-03-28 15:08:12 +0000 |
| commit | 2c9114656e7d01335a6ab2a71dc7bc3630a6d154 (patch) | |
| tree | 481dfe6f9c4aa5f725b6eade4c41d162375d6060 /src | |
| parent | major: Publish work-in-progress (diff) | |
| download | whirl-2c9114656e7d01335a6ab2a71dc7bc3630a6d154.tar.xz whirl-2c9114656e7d01335a6ab2a71dc7bc3630a6d154.zip | |
fix: Spawn servers properly
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs index 35c839d..002bfe8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,12 +7,16 @@ async fn main() -> Result<(), Box<dyn Error>> { dotenv::dotenv().ok(); pretty_env_logger::init(); - loop { - tokio::spawn(async move { - let _ = AutoServer::new("0.0.0.0:6650").await; - }); - tokio::spawn(async move { - let _ = RoomServer::new("0.0.0.0:5673").await; - }); + let mut threads = vec![]; + threads.push(tokio::spawn(async move { + let _ = AutoServer::new("0.0.0.0:6650").await; + })); + threads.push(tokio::spawn(async move { + let _ = RoomServer::new("0.0.0.0:5673").await; + })); + for thread in threads { + let _ = thread.await; } + + Ok(()) }
\ No newline at end of file |