mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-07-29 09:48:33 -04:00
fix sending unpublish event
This commit is contained in:
parent
808cbda229
commit
ee1e2b436f
5 changed files with 23 additions and 5 deletions
|
@ -275,7 +275,7 @@ impl RoutingTableInner {
|
|||
}
|
||||
/// Unpublish the node's current peer info
|
||||
pub fn unpublish_peer_info(&mut self, routing_domain: RoutingDomain) {
|
||||
self.with_routing_domain(routing_domain, |rdd| rdd.unpublish_peer_info())
|
||||
self.with_routing_domain(routing_domain, |rdd| rdd.unpublish_peer_info(self))
|
||||
}
|
||||
|
||||
/// Get the current published peer info
|
||||
|
|
|
@ -191,10 +191,19 @@ impl RoutingDomainDetail for LocalNetworkRoutingDomainDetail {
|
|||
true
|
||||
}
|
||||
|
||||
fn unpublish_peer_info(&self) {
|
||||
fn unpublish_peer_info(&self, rti: &RoutingTableInner) {
|
||||
let mut ppi_lock = self.published_peer_info.lock();
|
||||
veilid_log!(self debug "[LocalNetwork] Unpublished peer info");
|
||||
let opt_old_peer_info = ppi_lock.clone();
|
||||
*ppi_lock = None;
|
||||
|
||||
if let Err(e) = rti.event_bus().post(PeerInfoChangeEvent {
|
||||
routing_domain: RoutingDomain::LocalNetwork,
|
||||
opt_old_peer_info,
|
||||
opt_new_peer_info: None,
|
||||
}) {
|
||||
veilid_log!(self debug "Failed to post event: {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
fn ensure_dial_info_is_valid(&self, dial_info: &DialInfo) -> bool {
|
||||
|
|
|
@ -40,7 +40,7 @@ pub trait RoutingDomainDetail {
|
|||
|
||||
// Publish current peer info to the world
|
||||
fn publish_peer_info(&self, rti: &RoutingTableInner) -> bool;
|
||||
fn unpublish_peer_info(&self);
|
||||
fn unpublish_peer_info(&self, rti: &RoutingTableInner);
|
||||
|
||||
// Get the contact method required for node A to reach node B in this routing domain
|
||||
// Routing table must be locked for reading to use this function
|
||||
|
|
|
@ -170,10 +170,19 @@ impl RoutingDomainDetail for PublicInternetRoutingDomainDetail {
|
|||
true
|
||||
}
|
||||
|
||||
fn unpublish_peer_info(&self) {
|
||||
fn unpublish_peer_info(&self, rti: &RoutingTableInner) {
|
||||
let mut ppi_lock = self.published_peer_info.lock();
|
||||
veilid_log!(self debug "[PublicInternet] Unpublished peer info");
|
||||
let opt_old_peer_info = ppi_lock.clone();
|
||||
*ppi_lock = None;
|
||||
|
||||
if let Err(e) = rti.event_bus().post(PeerInfoChangeEvent {
|
||||
routing_domain: RoutingDomain::PublicInternet,
|
||||
opt_old_peer_info,
|
||||
opt_new_peer_info: None,
|
||||
}) {
|
||||
veilid_log!(self debug "Failed to post event: {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
fn ensure_dial_info_is_valid(&self, dial_info: &DialInfo) -> bool {
|
||||
|
|
|
@ -347,7 +347,7 @@ impl RoutingTable {
|
|||
let atomic_count = AtomicUsize::new(count);
|
||||
let _ = process_batched_future_queue_result(future_queue, MAX_PARALLEL_PINGS, stop_token, |res| {
|
||||
if let Err(e) = res {
|
||||
veilid_log!(self error "[{}] Error performing status ping: {}", name, e);
|
||||
veilid_log!(self debug "[{}] Error performing status ping: {}", name, e);
|
||||
}
|
||||
let remaining = atomic_count.fetch_sub(1, Ordering::AcqRel) - 1;
|
||||
if remaining > 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue