Skip to content

Commit

Permalink
Fix query routes update
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierHecart committed Jan 11, 2024
1 parent 7cdfc44 commit 567feb9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions zenoh/src/net/routing/dispatcher/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ pub(crate) fn update_query_routes(tables: &Tables, res: &Arc<Resource>) {
}
}

pub(crate) fn compute_query_routes_from(tables: &mut Tables, res: &mut Arc<Resource>) {
compute_query_routes(tables, res);
pub(crate) fn update_query_routes_from(tables: &mut Tables, res: &mut Arc<Resource>) {
update_query_routes(tables, res);
let res = get_mut_unchecked(res);
for child in res.childs.values_mut() {
compute_query_routes_from(tables, child);
update_query_routes_from(tables, child);
}
}

Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/net/routing/dispatcher/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ pub fn register_expr(
get_mut_unchecked(face)
.remote_mappings
.insert(expr_id, res.clone());
wtables.compute_matches_routes(&mut res);
wtables.update_matches_routes(&mut res);
drop(wtables);
}
},
Expand Down
10 changes: 5 additions & 5 deletions zenoh/src/net/routing/dispatcher/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,20 +145,20 @@ impl Tables {
self.faces.values().find(|face| face.zid == *zid)
}

fn compute_routes(&mut self, res: &mut Arc<Resource>) {
fn update_routes(&mut self, res: &mut Arc<Resource>) {
update_data_routes(self, res);
compute_query_routes(self, res);
update_query_routes(self, res);
}

pub(crate) fn compute_matches_routes(&mut self, res: &mut Arc<Resource>) {
pub(crate) fn update_matches_routes(&mut self, res: &mut Arc<Resource>) {
if res.context.is_some() {
self.compute_routes(res);
self.update_routes(res);

let resclone = res.clone();
for match_ in &mut get_mut_unchecked(res).context_mut().matches {
let match_ = &mut match_.upgrade().unwrap();
if !Arc::ptr_eq(match_, &resclone) && match_.context.is_some() {
self.compute_routes(match_);
self.update_routes(match_);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/net/routing/hat/linkstate_peer/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ pub(super) fn queries_tree_change(tables: &mut Tables, new_childs: &[Vec<NodeInd
}

// recompute routes
compute_query_routes_from(tables, &mut tables.root_res.clone());
update_query_routes_from(tables, &mut tables.root_res.clone());
}

#[inline]
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/net/routing/hat/router/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@ pub(super) fn queries_tree_change(
}

// recompute routes
compute_query_routes_from(tables, &mut tables.root_res.clone());
update_query_routes_from(tables, &mut tables.root_res.clone());
}

#[inline]
Expand Down

0 comments on commit 567feb9

Please sign in to comment.