review pass the last
This commit is contained in:
@@ -440,10 +440,12 @@ fn create_dns_pool() -> io::Result<BlockingPool> {
|
||||
.map(usize::from)
|
||||
.unwrap_or(2)
|
||||
.clamp(2, 4);
|
||||
let mut spawned = 0usize;
|
||||
let mut last_error = None;
|
||||
|
||||
for index in 0..worker_count {
|
||||
let receiver = Arc::clone(&receiver);
|
||||
thread::Builder::new()
|
||||
match thread::Builder::new()
|
||||
.name(format!("ruin-runtime-dns-{index}"))
|
||||
.spawn(move || {
|
||||
loop {
|
||||
@@ -456,8 +458,16 @@ fn create_dns_pool() -> io::Result<BlockingPool> {
|
||||
Err(_) => break,
|
||||
}
|
||||
}
|
||||
})
|
||||
.map_err(io::Error::other)?;
|
||||
}) {
|
||||
Ok(_) => spawned += 1,
|
||||
Err(error) => last_error = Some(error),
|
||||
}
|
||||
}
|
||||
|
||||
if spawned == 0 {
|
||||
return Err(io::Error::other(last_error.expect(
|
||||
"at least one DNS worker spawn should have been attempted",
|
||||
)));
|
||||
}
|
||||
|
||||
Ok(BlockingPool { sender })
|
||||
@@ -593,7 +603,7 @@ impl RawSocketAddr {
|
||||
sin_family: libc::AF_INET as libc::sa_family_t,
|
||||
sin_port: addr.port().to_be(),
|
||||
sin_addr: libc::in_addr {
|
||||
s_addr: u32::from_ne_bytes(addr.ip().octets()),
|
||||
s_addr: u32::from_be_bytes(addr.ip().octets()).to_be(),
|
||||
},
|
||||
sin_zero: [0; 8],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user