mirror of
https://github.com/szymon-jozef/checkers.git
synced 2026-10-27 19:20:44 +01:00
feat: add server binary
This commit is contained in:
13
src/bin/server.rs
Normal file
13
src/bin/server.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
use checkers::network::server::Server;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut server: Server = Server::new().await;
|
||||
|
||||
env_logger::init();
|
||||
|
||||
server.start().await;
|
||||
server.update().await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
2
src/lib.rs
Normal file
2
src/lib.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
pub mod logic;
|
||||
pub mod network;
|
||||
@@ -1,5 +1,3 @@
|
||||
mod logic;
|
||||
mod network;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
mod client;
|
||||
mod connection;
|
||||
mod message;
|
||||
mod server;
|
||||
pub mod client;
|
||||
pub mod connection;
|
||||
pub mod message;
|
||||
pub mod server;
|
||||
|
||||
@@ -79,6 +79,8 @@ impl Server {
|
||||
.take()
|
||||
.expect("Cannot start the server without tcp listener.");
|
||||
|
||||
info!("Starting the server at: {:?}", listener.local_addr());
|
||||
|
||||
let sender = self.sender.clone();
|
||||
|
||||
tokio::spawn(async move {
|
||||
|
||||
Reference in New Issue
Block a user