mirror of
https://github.com/szymon-jozef/checkers.git
synced 2026-10-28 11:10:44 +01:00
feat: add saving and reading server setting from config file
This commit is contained in:
@@ -23,15 +23,9 @@ use crate::{
|
||||
},
|
||||
network_identity::NetworkServerIdentity,
|
||||
},
|
||||
settings::{general_settings::SettingsLike, server_settings::ServerSettings},
|
||||
};
|
||||
|
||||
// TODO! More settings!
|
||||
pub struct ServerSettings {
|
||||
pub addr: SocketAddr,
|
||||
pub max_connections: usize,
|
||||
pub allow_spectators: bool,
|
||||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
enum ServerStage {
|
||||
Lobby,
|
||||
@@ -71,11 +65,7 @@ pub struct Server {
|
||||
impl Server {
|
||||
pub async fn new() -> Server {
|
||||
// TODO! Should be read from a file
|
||||
let settings = ServerSettings {
|
||||
addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 6767),
|
||||
max_connections: 2,
|
||||
allow_spectators: false,
|
||||
};
|
||||
let settings = ServerSettings::new();
|
||||
|
||||
let (sender, reciever) =
|
||||
tokio::sync::mpsc::channel::<(SocketAddr, Message<ClientMessage>)>(1024); // random
|
||||
|
||||
Reference in New Issue
Block a user