Default port now 4242 everywhere (#14)

This commit is contained in:
Ferdinand Schober
2023-06-11 21:54:40 +02:00
committed by GitHub
parent f0d70492c5
commit b74f1b4291
4 changed files with 8 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
use std::{net::SocketAddr, error::Error, fmt::Display, sync::{Arc, atomic::{AtomicBool, Ordering, AtomicU32}, RwLock}};
use crate::{config, dns};
use crate::{config::{self, DEFAULT_PORT}, dns};
#[derive(Eq, Hash, PartialEq, Clone, Copy)]
pub enum Position {
@@ -56,7 +56,7 @@ impl ClientManager {
None => return Err(Box::new(ClientConfigError{})),
},
};
let addr = SocketAddr::new(ip, client.port.unwrap_or(2020));
let addr = SocketAddr::new(ip, client.port.unwrap_or(DEFAULT_PORT));
self.register_client(addr, pos);
Ok(())
}

View File

@@ -8,6 +8,8 @@ use toml;
use crate::client::Position;
pub const DEFAULT_PORT: u16 = 4242;
#[derive(Serialize, Deserialize, Debug)]
pub struct ConfigToml {
pub port: Option<u16>,
@@ -86,8 +88,6 @@ impl Config {
backend => backend,
};
const DEFAULT_PORT: u16 = 4242;
let port = match find_arg("--port")? {
Some(port) => port.parse::<u16>()?,
None => match &config_toml {