aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-03-28 15:08:12 -0700
committerFuwn <[email protected]>2021-03-28 15:08:12 -0700
commitcb701954153526adf363dca0822820198e1ac6bb (patch)
tree6e1b03f93365fe9b298d62d93913d19f90eaffa5
parentmajor: Publish work-in-progress (diff)
downloadwhirl-cb701954153526adf363dca0822820198e1ac6bb.tar.xz
whirl-cb701954153526adf363dca0822820198e1ac6bb.zip
fix: Spawn servers properly
-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