ignore errors if an interface can't join multicast
This works okay on my home network, but it's a little more magical than I wanted - I can't force it to pick up the wifi interface. If the Ethernet is plugged in, the laptop always and only picks that, even if I know the server only asked the Ethernet interface. This is fine, but only because my Ethernet happens to be faster than my Wifi. I'm not sure how it will behave at work, where WiFi and Ethernet may be separate networks. At least the error messages are better now, so I can figure out why it wasn't auto-starting with systemd.main
parent
7a0880fc02
commit
221a0bef2f
|
@ -30,7 +30,9 @@ pub async fn client <I : Iterator <Item=String>> (mut args: I) -> Result <(), Ap
|
|||
let socket = UdpSocket::bind (SocketAddrV4::new (Ipv4Addr::UNSPECIFIED, 0)).await?;
|
||||
|
||||
for bind_addr in bind_addrs {
|
||||
socket.join_multicast_v4 (common_params.multicast_addr, bind_addr)?;
|
||||
if let Err (e) = socket.join_multicast_v4 (common_params.multicast_addr, bind_addr) {
|
||||
println! ("Error joining multicast group with iface {}: {:?}", bind_addr, e);
|
||||
}
|
||||
}
|
||||
|
||||
let mut idem_id = [0u8; 8];
|
||||
|
|
|
@ -15,7 +15,9 @@ pub async fn server <I: Iterator <Item=String>> (args: I) -> Result <(), AppErro
|
|||
let socket = UdpSocket::bind (SocketAddrV4::new (Ipv4Addr::UNSPECIFIED, params.common.server_port)).await?;
|
||||
|
||||
for bind_addr in ¶ms.bind_addrs {
|
||||
socket.join_multicast_v4 (params.common.multicast_addr, *bind_addr)?;
|
||||
if let Err (e) = socket.join_multicast_v4 (params.common.multicast_addr, *bind_addr) {
|
||||
println! ("Error joining multicast group with iface {}: {:?}", bind_addr, e);
|
||||
}
|
||||
}
|
||||
|
||||
serve_interface (params, socket).await?;
|
||||
|
|
Loading…
Reference in New Issue