Merge pull request 'made set_reuse_port unix only' (#87) from tcp_windows_fix into main
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good

Reviewed-on: #87
This commit is contained in:
Robin Müller 2023-10-26 13:40:39 +02:00
commit bb3fd8fe74

View File

@ -180,6 +180,7 @@ impl<
// Create a TCP listener bound to two addresses. // Create a TCP listener bound to two addresses.
let socket = Socket::new(Domain::IPV4, Type::STREAM, None)?; let socket = Socket::new(Domain::IPV4, Type::STREAM, None)?;
socket.set_reuse_address(cfg.reuse_addr)?; socket.set_reuse_address(cfg.reuse_addr)?;
#[cfg(unix)]
socket.set_reuse_port(cfg.reuse_port)?; socket.set_reuse_port(cfg.reuse_port)?;
let addr = (cfg.addr).into(); let addr = (cfg.addr).into();
socket.bind(&addr)?; socket.bind(&addr)?;