starts but doesn't work

This commit is contained in:
Joe Ardent 2025-08-08 11:10:14 -07:00
parent 94c912f54f
commit 8e9a9ed86f
2 changed files with 8 additions and 5 deletions

View file

@ -65,7 +65,7 @@ impl Config {
gen_ssl(&key, &cert)? gen_ssl(&key, &cert)?
}; };
let config = Self { let mut config = Self {
multicast_addr: SocketAddrV4::new(MULTICAST_IP, DEFAULT_PORT), multicast_addr: SocketAddrV4::new(MULTICAST_IP, DEFAULT_PORT),
download_dir, download_dir,
local_ip_addr: Some(local_ip_addr), local_ip_addr: Some(local_ip_addr),
@ -80,7 +80,7 @@ impl Config {
}, },
}; };
let config = if !config_file.exists() { let mut config = if !config_file.exists() {
log::info!("creating config file at {config_file:?}"); log::info!("creating config file at {config_file:?}");
std::fs::write(&config_file, toml::to_string(&config)?)?; std::fs::write(&config_file, toml::to_string(&config)?)?;
config config
@ -92,6 +92,12 @@ impl Config {
.map_err(Box::new)? // boxed because the error size from figment is large .map_err(Box::new)? // boxed because the error size from figment is large
}; };
if config.local_ip_addr.is_none() {
config.local_ip_addr = Some(local_ip_addr);
}
log::info!("using config: {config:?}");
Ok(config) Ok(config)
} }

View file

@ -35,12 +35,9 @@ impl JocalService {
// TODO: make addr config // TODO: make addr config
let addr = SocketAddr::from(([0, 0, 0, 0], self.config.device.port)); let addr = SocketAddr::from(([0, 0, 0, 0], self.config.device.port));
let (key, cert) = self.config.ssl(); let (key, cert) = self.config.ssl();
let listener = TcpListener::bind(&addr).await?;
let ssl_config = rustls_server_config(key, cert); let ssl_config = rustls_server_config(key, cert);
// let acceptor = TlsAcceptor::from(ssl_config);
// let stop = Arc::new(Mutex::new(stop_rx)); // let stop = Arc::new(Mutex::new(stop_rx));
/* /*