fix running on non-unix

This commit is contained in:
Johann150 2023-03-17 20:57:23 +01:00
parent d7af072826
commit 48061e555b
No known key found for this signature in database
GPG key ID: 9EE6577A2A06F8F1

View file

@ -159,6 +159,7 @@ static ARGS: Lazy<Args> = Lazy::new(|| {
struct Args {
addrs: Vec<SocketAddr>,
#[allow(dead_code)] // only used on unix, so dead code on windows
sockets: Vec<PathBuf>,
content_dir: PathBuf,
certs: Arc<certificates::CertStore>,
@ -347,12 +348,21 @@ fn args() -> Result<Args> {
addrs.push(i.parse()?);
}
#[allow(unused_mut)] // only used on unix
let mut empty = addrs.is_empty();
#[allow(unused_mut)] // only used on unix
let mut sockets = vec![];
for i in matches.opt_strs("socket") {
sockets.push(i.parse()?);
#[cfg(unix)]
{
for i in matches.opt_strs("socket") {
sockets.push(i.parse()?);
}
empty &= sockets.is_empty();
}
if addrs.is_empty() && sockets.is_empty() {
if empty {
addrs = vec![
SocketAddr::new(IpAddr::V6(Ipv6Addr::UNSPECIFIED), DEFAULT_PORT),
SocketAddr::new(IpAddr::V4(Ipv4Addr::UNSPECIFIED), DEFAULT_PORT),