@@ -21,7 +21,6 @@ use zenoh_protocol::{
2121 core:: { Region , Reliability , WireExpr } ,
2222 network:: { declare:: SubscriberId , push:: ext, Push } ,
2323} ;
24- use zenoh_sync:: get_mut_unchecked;
2524
2625use super :: {
2726 face:: FaceState ,
@@ -32,7 +31,6 @@ use crate::net::routing::{
3231 dispatcher:: {
3332 face:: Face ,
3433 local_resources:: { LocalResourceInfoTrait , LocalResources } ,
35- tables:: TablesData ,
3634 } ,
3735 gateway:: { get_or_set_route, node_id_as_source, Direction , RouteBuilder } ,
3836 hat:: { DispatcherContext , SendDeclare } ,
@@ -105,6 +103,8 @@ impl Face {
105103 sub_info,
106104 ) ;
107105
106+ hats[ region] . disable_data_routes ( ctx. tables , & mut res) ;
107+
108108 for region in hats. regions ( ) . copied ( ) . collect_vec ( ) {
109109 let other_info = hats
110110 . values ( )
@@ -113,8 +113,6 @@ impl Face {
113113 . reduce ( |_, _| SubscriberInfo ) ;
114114
115115 hats[ region] . propagate_subscriber ( ctx. reborrow ( ) , res. clone ( ) , other_info) ;
116-
117- disable_matches_data_routes ( ctx. tables , & mut res) ;
118116 }
119117
120118 drop ( wtables) ;
@@ -192,7 +190,7 @@ impl Face {
192190 if let Some ( mut res) =
193191 hats[ region] . unregister_subscriber ( ctx. reborrow ( ) , id, res. clone ( ) , node_id)
194192 {
195- disable_matches_data_routes ( ctx. tables , & mut res) ;
193+ hats [ region ] . disable_data_routes ( ctx. tables , & mut res) ;
196194
197195 let mut remaining = tables
198196 . hats
@@ -212,34 +210,6 @@ impl Face {
212210 }
213211}
214212
215- /// Disables data routes for the given [`Resource`].
216- ///
217- /// ## Note
218- ///
219- /// **Changes in data/query routes are not hat-local**. For example, a north peer hat has routes for data
220- /// that originate from south-bound remotes but has no routes for data that originate in its north
221- /// region, thus a change in a broker's data routes affects the routes of the north peer hat.
222- pub ( crate ) fn disable_matches_data_routes ( _tables : & mut TablesData , res : & mut Arc < Resource > ) {
223- if res. ctx . is_some ( ) {
224- for hat in get_mut_unchecked ( res) . context_mut ( ) . hats . values_mut ( ) {
225- hat. disable_data_routes ( ) ;
226- }
227-
228- for match_ in & res. context ( ) . matches {
229- let mut match_ = match_. upgrade ( ) . unwrap ( ) ;
230- if !Arc :: ptr_eq ( & match_, res) {
231- for hat in get_mut_unchecked ( & mut match_)
232- . context_mut ( )
233- . hats
234- . values_mut ( )
235- {
236- hat. disable_data_routes ( ) ;
237- }
238- }
239- }
240- }
241- }
242-
243213macro_rules! treat_timestamp {
244214 ( $hlc: expr, $payload: expr, $drop: expr) => {
245215 // if an HLC was configured (via Config.add_timestamp),
@@ -286,7 +256,7 @@ fn get_data_route(
286256) -> Arc < Route > {
287257 let node_id = tables. hats [ region] . map_routing_context ( & tables. data , src_face, node_id) ;
288258 let compute_route =
289- || tables. hats [ region] . compute_data_route ( & tables. data , src_face, expr, node_id) ;
259+ || tables. hats [ region] . compute_data_route ( & tables. data , & src_face. region , expr, node_id) ;
290260 match expr
291261 . resource ( )
292262 . as_ref ( )
@@ -296,7 +266,7 @@ fn get_data_route(
296266 Some ( data_routes) => get_or_set_route (
297267 data_routes,
298268 tables. data . hats [ region] . routes_version ,
299- & src_face. region . bound ( ) ,
269+ & src_face. region ,
300270 node_id,
301271 compute_route,
302272 ) ,
0 commit comments