diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-11-13 17:22:12 +0100 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-11-13 17:22:12 +0100 |
commit | fb9d1a58cfc22473c9d6988d08154bd26f83c1bf (patch) | |
tree | d1777b3e2028f2bf6b68771731d1a473d69fee48 | |
parent | c5c79df2d2a6e598f64c9cf75e53e018e66678f1 (diff) |
don't die on send errors
-rw-r--r-- | src/main.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 46f063a..1498dc5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -167,7 +167,7 @@ async fn main() -> Result<()> { } }, - packet = dhcp6c.to_send() => send_dhcp6(&mut dhcp6, &sock, packet).await?, + packet = dhcp6c.to_send() => send_dhcp6(&mut dhcp6, &sock, packet).await, result = dhcp6c_rx.changed() => { result?; @@ -321,7 +321,14 @@ fn handle(dhcp6: &mut Dhcp6, dhcp6c: &mut Dhcp6c, buf: &[u8]) -> Result<()> { Ok(()) } -async fn send_dhcp6(dhcp6: &mut Dhcp6, sock: &UdpSocket, packet: Packet) -> Result<()> { +async fn send_dhcp6(dhcp6: &mut Dhcp6, sock: &UdpSocket, packet: Packet) { + match do_send_dhcp6(dhcp6, sock, packet).await { + Ok(_) => {} + Err(e) => println!("[warn] -> send error: {}", e), + } +} + +async fn do_send_dhcp6(dhcp6: &mut Dhcp6, sock: &UdpSocket, packet: Packet) -> Result<()> { if packet != dhcp6.last_sent { dhcp6.xid = rand::random(); } |