aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2023-11-13 17:22:12 +0100
committerHimbeerserverDE <himbeerserverde@gmail.com>2023-11-13 17:22:12 +0100
commitfb9d1a58cfc22473c9d6988d08154bd26f83c1bf (patch)
treed1777b3e2028f2bf6b68771731d1a473d69fee48
parentc5c79df2d2a6e598f64c9cf75e53e018e66678f1 (diff)
don't die on send errors
-rw-r--r--src/main.rs11
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();
}