aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-03-28 15:08:12 +0000
committerFuwn <[email protected]>2021-03-28 15:08:12 +0000
commit2c9114656e7d01335a6ab2a71dc7bc3630a6d154 (patch)
tree481dfe6f9c4aa5f725b6eade4c41d162375d6060 /src
parentmajor: Publish work-in-progress (diff)
downloadwhirl-2c9114656e7d01335a6ab2a71dc7bc3630a6d154.tar.xz
whirl-2c9114656e7d01335a6ab2a71dc7bc3630a6d154.zip
fix: Spawn servers properly
Diffstat (limited to 'src')
-rw-r--r--src/main.rs18
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