Skip to content

Commit

Permalink
fix error handling in portchange
Browse files Browse the repository at this point in the history
  • Loading branch information
feschber committed Dec 27, 2023
1 parent b0df901 commit 0fffd5b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,8 @@ impl Server {
let _ = receiver_tx.send(event).await;
}
event = sender_rx.recv() => {
let (event, addr) = match event {
Some(e) => e,
None => break,
let Some((event, addr)) = event else {
break;
};
if let Err(e) = send_event(&socket, event, addr) {
log::warn!("udp send failed: {e}");
Expand All @@ -270,7 +269,7 @@ impl Server {
let current_port = socket.local_addr().unwrap().port();
if current_port == port {
let _ = frontend_notify_tx.send(FrontendNotify::NotifyPortChange(port, None)).await;
return;
continue;
};

let listen_addr = SocketAddr::new("0.0.0.0".parse().unwrap(), port);
Expand Down

0 comments on commit 0fffd5b

Please sign in to comment.