@@ -32,6 +32,7 @@ use crate::net::routing::{
3232 dispatcher:: {
3333 face:: Face ,
3434 local_resources:: { LocalResourceInfoTrait , LocalResources } ,
35+ tables:: TablesData ,
3536 } ,
3637 hat:: { BaseContext , SendDeclare } ,
3738 router:: { get_or_set_route, Direction , RouteBuilder } ,
@@ -113,7 +114,8 @@ impl Face {
113114 . reduce ( |_, _| SubscriberInfo ) ;
114115
115116 hats[ region] . propagate_subscription ( ctx. reborrow ( ) , res. clone ( ) , other_info) ;
116- disable_matches_data_routes ( & mut res, & region) ;
117+
118+ disable_matches_data_routes ( ctx. tables , & mut res) ;
117119 }
118120
119121 drop ( wtables) ;
@@ -188,7 +190,7 @@ impl Face {
188190 if let Some ( mut res) =
189191 hats[ region] . unregister_subscription ( ctx. reborrow ( ) , id, res. clone ( ) , node_id)
190192 {
191- disable_matches_data_routes ( & mut res, & region ) ;
193+ disable_matches_data_routes ( ctx . tables , & mut res) ;
192194
193195 let mut remaining = tables
194196 . hats
@@ -208,16 +210,29 @@ impl Face {
208210 }
209211}
210212
211- /// Disables data routes of the given regions's hat.
213+ /// Disables data routes for the given [`Resource`].
214+ ///
215+ /// ## Note
212216///
213- /// A subscription declaration or undeclaration should in theory only invalidate data routes of its owner hat.
214- pub ( crate ) fn disable_matches_data_routes ( res : & mut Arc < Resource > , region : & Region ) {
217+ /// **Changes in data/query routes are not hat-local**. For example, a north peer hat has routes for data
218+ /// that originate from south-bound remotes but has no routes for data that originate in its north
219+ /// region, thus a change in a broker's data routes affects the routes of the north peer hat.
220+ pub ( crate ) fn disable_matches_data_routes ( _tables : & mut TablesData , res : & mut Arc < Resource > ) {
215221 if res. ctx . is_some ( ) {
216- get_mut_unchecked ( res) . context_mut ( ) . hats [ region] . disable_data_routes ( ) ;
222+ for hat in get_mut_unchecked ( res) . context_mut ( ) . hats . values_mut ( ) {
223+ hat. disable_data_routes ( ) ;
224+ }
225+
217226 for match_ in & res. context ( ) . matches {
218227 let mut match_ = match_. upgrade ( ) . unwrap ( ) ;
219228 if !Arc :: ptr_eq ( & match_, res) {
220- get_mut_unchecked ( & mut match_) . context_mut ( ) . hats [ region] . disable_data_routes ( ) ;
229+ for hat in get_mut_unchecked ( & mut match_)
230+ . context_mut ( )
231+ . hats
232+ . values_mut ( )
233+ {
234+ hat. disable_data_routes ( ) ;
235+ }
221236 }
222237 }
223238 }
0 commit comments