Skip to content

Commit

Permalink
fixes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisBiryukov91 committed Feb 1, 2024
1 parent 2cf21f0 commit ae0811e
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 1 deletion.
3 changes: 3 additions & 0 deletions zenoh/src/net/routing/hat/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ impl HatBaseTrait for HatCode {
fn info(&self, _tables: &Tables, _kind: WhatAmI) -> String {
"graph {}".to_string()
}

fn close(&self, _tables: &mut Tables) {
}
}

struct HatContext {}
Expand Down
6 changes: 6 additions & 0 deletions zenoh/src/net/routing/hat/linkstate_peer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,12 @@ impl HatBaseTrait for HatCode {
_ => "graph {}".to_string(),
}
}

fn close(&self, tables: &mut Tables) {
hat_mut!(tables).peer_qabls.clear();
hat_mut!(tables).peer_subs.clear();
hat_mut!(tables).peers_net.take();
}
}

struct HatContext {
Expand Down
1 change: 1 addition & 0 deletions zenoh/src/net/routing/hat/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ pub(crate) trait HatBaseTrait {
) -> ZResult<()>;

fn close_face(&self, tables: &TablesLock, face: &mut Arc<FaceState>);
fn close(&self, tables: &mut Tables);
}

pub(crate) trait HatPubSubTrait {
Expand Down
4 changes: 4 additions & 0 deletions zenoh/src/net/routing/hat/p2p_peer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ impl HatBaseTrait for HatCode {
fn info(&self, _tables: &Tables, _kind: WhatAmI) -> String {
"graph {}".to_string()
}

fn close(&self, tables: &mut Tables) {
hat_mut!(tables).gossip.take();
}
}

struct HatContext {}
Expand Down
9 changes: 9 additions & 0 deletions zenoh/src/net/routing/hat/router/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,15 @@ impl HatBaseTrait for HatCode {
_ => "graph {}".to_string(),
}
}

fn close(&self, tables: &mut Tables) {
hat_mut!(tables).peer_qabls.clear();
hat_mut!(tables).router_qabls.clear();
hat_mut!(tables).peer_subs.clear();
hat_mut!(tables).router_subs.clear();
hat_mut!(tables).peers_net.take();
hat_mut!(tables).routers_net.take();
}
}

struct HatContext {
Expand Down
5 changes: 4 additions & 1 deletion zenoh/src/net/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use super::primitives::DeMux;
use super::routing;
use super::routing::router::Router;
use crate::config::{unwrap_or_default, Config, ModeDependent, Notifier};
use crate::net::routing::resource::Resource;
use crate::net::routing::dispatcher::resource::Resource;
use crate::GIT_VERSION;
pub use adminspace::AdminSpace;
use async_std::task::JoinHandle;
Expand Down Expand Up @@ -173,7 +173,10 @@ impl Runtime {
// clean up to break cyclic reference of self.state to itself
let router = self.router();
let mut tables = router.tables.tables.write().unwrap();

Resource::close(&mut tables.root_res);
let hat_code = tables.hat_code.clone();
hat_code.close(&mut tables);

drop(tables);
self.state.transport_handlers.write().unwrap().clear();
Expand Down

0 comments on commit ae0811e

Please sign in to comment.