Skip to content

Commit

Permalink
Fix bug regarding matching status and publisher allowed destination (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierHecart authored Dec 5, 2023
1 parent c0ebfff commit 5ee57d9
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions zenoh/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1502,10 +1502,23 @@ impl Session {
&mut RoutingExpr::new(&tables.root_res, key_expr.as_str()),
0,
);
drop(tables);
let matching = match destination {
Locality::Any => !route.is_empty(),
Locality::Remote => route.values().any(|dir| !dir.0.is_local()),
Locality::SessionLocal => route.values().any(|dir| dir.0.is_local()),
Locality::Remote => {
if let Some(face) = zread!(self.state).primitives.as_ref() {
route.values().any(|dir| !Arc::ptr_eq(&dir.0, &face.state))
} else {
!route.is_empty()
}
}
Locality::SessionLocal => {
if let Some(face) = zread!(self.state).primitives.as_ref() {
route.values().any(|dir| Arc::ptr_eq(&dir.0, &face.state))
} else {
false
}
}
};
Ok(MatchingStatus { matching })
}
Expand Down

0 comments on commit 5ee57d9

Please sign in to comment.