Skip to content

Commit

Permalink
fix send panic
Browse files Browse the repository at this point in the history
  • Loading branch information
huan-xi authored Jan 27, 2024
1 parent c43829a commit f85841b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,20 +221,20 @@ impl Drop for Shutdown {
}
}

#[derive(Clone)]
struct CommandSender(Vec<mpsc::UnboundedSender<Command>>);
impl CommandSender {
fn send(&mut self, cmd: Command) {
for tx in self.0.iter_mut() {
tx.send(cmd.clone()).expect("responder died");
if let Err(_) = tx.send(cmd.clone()) {
warn!("responder died");
}
}
}

fn send_unsolicited(&mut self, svc: ServiceData, ttl: u32, include_ip: bool) {
self.send(Command::SendUnsolicited {
svc: svc,
ttl: ttl,
include_ip: include_ip,
svc,
ttl,
include_ip,
});
}

Expand Down

0 comments on commit f85841b

Please sign in to comment.