diff options
| author | Fuwn <[email protected]> | 2021-03-22 17:45:35 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-03-22 17:45:35 +0000 |
| commit | 13edb02ff4be35fa9a30e783d4a1e8bed323e0f2 (patch) | |
| tree | 628865084867c3f2c5449f7682a6e833dd998004 /src/main.rs | |
| parent | fix: Only send to one client not all for certain commands (diff) | |
| download | whirl-13edb02ff4be35fa9a30e783d4a1e8bed323e0f2.tar.xz whirl-13edb02ff4be35fa9a30e783d4a1e8bed323e0f2.zip | |
etc: ...
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/main.rs b/src/main.rs index fc0f560..2534b40 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,28 +2,31 @@ extern crate log; use mio::net::TcpListener; +use std::thread; use whirl::server; fn main() { dotenv::dotenv().ok(); // Adds ability to use environment variables. pretty_env_logger::init(); // Adds pretty logging. - std::thread::spawn(|| { - server::world::WorldServer::new( + let mut threads = vec![]; + threads.push(thread::spawn(move || { + debug!("spawned WorldServer thread"); + server::world::server::WorldServer::new( TcpListener::bind( &"0.0.0.0:6650".parse().unwrap() ).unwrap() ); - }).join().unwrap(); - debug!("spawned WorldServer thread"); - - // POC, unimplemented. - // std::thread::spawn(move || { - // server::auto::AutoServer::new( - // TcpListener::bind( - // &"0.0.0.0:1337".parse().unwrap() - // ).unwrap() - // ); - // }); - // debug!("spawned AutoServer thread"); + })); + threads.push(thread::spawn(move || { + debug!("spawned AutoServer thread"); + server::auto::server::AutoServer::new( + TcpListener::bind( + &"0.0.0.0:5673".parse().unwrap() + ).unwrap() + ); + })); + for thread in threads { + let _ = thread.join(); + } } |