Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions rust/networking/src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,15 @@ impl Discovery {

let addrs = self.ifaces.lock().clone();
debug!("announcing Hello({nonce:?}) to {addrs:?}");
// rev so .remove() doesn't break things
for (i, addr) in addrs.into_iter().enumerate().rev() {
for addr in addrs.into_iter().rev() {
match self.sock.send_to(&buf, addr).await {
Ok(bytes) => trace!("sent {bytes} to {addr}"),
Err(e) if e.kind() == io::ErrorKind::HostUnreachable => {
debug!("disabling discovery address {addr}: {e}");
_ = self.ifaces.lock().swap_remove(i);
// EHOSTUNREACH is transient on macOS (observed right after boot /
// wake / link changes). Interfaces that actually disappear are
// already pruned by the netwatcher callback via diff.removed, so
// don't permanently drop the address here.
debug!("transient host unreachable for {addr}: {e}");
}
Err(e) => debug!("failed to reach {addr}: {e}"),
}
Expand Down