rpki/src/rtr/server/notifier.rs
2026-05-13 16:49:10 +08:00

21 lines
390 B
Rust

use tokio::sync::broadcast;
#[derive(Clone)]
pub struct RtrNotifier {
tx: broadcast::Sender<()>,
}
impl RtrNotifier {
pub fn new(tx: broadcast::Sender<()>) -> Self {
Self { tx }
}
pub fn notify_cache_updated(&self) -> usize {
self.tx.send(()).unwrap_or_default()
}
pub fn listener_count(&self) -> usize {
self.tx.receiver_count()
}
}