From 6642fd7e4f6faf257a2fffc81a990a710858fbc2 Mon Sep 17 00:00:00 2001 From: OlivierHecart Date: Mon, 4 Dec 2023 15:15:37 +0100 Subject: [PATCH] Fix bug regarding matching status and publisher allowed destination --- zenoh/src/session.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/zenoh/src/session.rs b/zenoh/src/session.rs index 8c566a6640..23369e5790 100644 --- a/zenoh/src/session.rs +++ b/zenoh/src/session.rs @@ -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 }) }