aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-03-25 22:20:21 +0000
committerFuwn <[email protected]>2021-03-25 22:20:21 +0000
commit5fc28bfb2851441893ef2ad5f72e0feb8a0a22cc (patch)
treef39b7bccc486298b1b7f4945cad37b4839817b73 /src/main.rs
parentfeature: Byte utilities (diff)
downloadwhirl-5fc28bfb2851441893ef2ad5f72e0feb8a0a22cc.tar.xz
whirl-5fc28bfb2851441893ef2ad5f72e0feb8a0a22cc.zip
major: Publish work-in-progress
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs44
1 files changed, 15 insertions, 29 deletions
diff --git a/src/main.rs b/src/main.rs
index 92a35d0..35c839d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,32 +1,18 @@
-#[macro_use]
-extern crate log;
+use whirl::server::auto::server::AutoServer;
+use std::error::Error;
+use whirl::server::room::server::RoomServer;
-use mio::net::TcpListener;
-use std::thread;
-use whirl::server;
+#[tokio::main]
+async fn main() -> Result<(), Box<dyn Error>> {
+ dotenv::dotenv().ok();
+ pretty_env_logger::init();
-fn main() {
- dotenv::dotenv().ok(); // Adds ability to use environment variables
- pretty_env_logger::init(); // Adds pretty logging
-
- let mut threads = vec![];
- threads.push(thread::spawn(move || {
- debug!("spawned AutoServer thread");
- server::auto::server::AutoServer::new(
- TcpListener::bind(
- &"0.0.0.0:6650".parse().unwrap()
- ).unwrap()
- );
- }));
- threads.push(thread::spawn(move || {
- debug!("spawned RoomServer thread");
- server::room::server::RoomServer::new(
- TcpListener::bind(
- &"0.0.0.0:5673".parse().unwrap()
- ).unwrap()
- );
- }));
- for thread in threads {
- let _ = thread.join(); // Handle Result by dissolving it.
+ 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;
+ });
}
-}
+} \ No newline at end of file