14
14
15
15
#[ zenoh_macros:: unstable]
16
16
use std:: collections:: HashMap ;
17
- use std:: { ops :: Not , sync:: Arc } ;
17
+ use std:: sync:: Arc ;
18
18
19
19
use zenoh_core:: zread;
20
20
use zenoh_protocol:: {
@@ -33,7 +33,6 @@ use super::{
33
33
use crate :: key_expr:: KeyExpr ;
34
34
use crate :: net:: routing:: {
35
35
hat:: { HatTrait , SendDeclare } ,
36
- interceptor:: InterceptorTrait ,
37
36
router:: get_or_set_route,
38
37
RoutingContext ,
39
38
} ;
@@ -300,23 +299,15 @@ pub fn route_data(
300
299
msg. wire_expr. suffix. as_ref( )
301
300
) ;
302
301
303
- if let Some ( interceptor) = face
304
- . state
305
- . in_interceptors
306
- . as_ref ( )
307
- . map ( |i| i. load ( ) )
308
- . and_then ( |i| i. is_empty ( ) . not ( ) . then_some ( i) )
309
- {
310
- let cache_guard = prefix. get_ingress_cache ( face, & interceptor) ;
311
- let cache = cache_guard. as_ref ( ) . and_then ( |c| c. get_ref ( ) . as_ref ( ) ) ;
302
+ if let Some ( interceptor) = face. load_ingress_interceptors ( ) {
312
303
let ctx = & mut RoutingContext :: new ( NetworkMessageMut {
313
304
body : NetworkBodyMut :: Push ( msg) ,
314
305
reliability,
315
306
#[ cfg( feature = "stats" ) ]
316
307
size : None ,
317
308
} ) ;
318
309
319
- if !interceptor. intercept ( ctx, cache ) {
310
+ if !interceptor. intercept_with_face ( ctx, face , & prefix ) {
320
311
return ;
321
312
}
322
313
} ;
@@ -365,24 +356,15 @@ pub fn route_data(
365
356
msg. wire_expr = key_expr. into ( ) ;
366
357
msg. ext_nodeid = ext:: NodeIdType { node_id : * context } ;
367
358
368
- if let Some ( interceptor) = face
369
- . state
370
- . eg_interceptors
371
- . as_ref ( )
372
- . map ( |i| i. load ( ) )
373
- . and_then ( |i| i. is_empty ( ) . not ( ) . then_some ( i) )
374
- {
375
- let cache_guard = prefix. get_ingress_cache ( face, & interceptor) ;
376
- let cache = cache_guard. as_ref ( ) . and_then ( |c| c. get_ref ( ) . as_ref ( ) ) ;
377
-
359
+ if let Some ( interceptor) = face. load_egress_interceptors ( ) {
378
360
let ctx = & mut RoutingContext :: new ( NetworkMessageMut {
379
361
body : NetworkBodyMut :: Push ( msg) ,
380
362
reliability,
381
363
#[ cfg( feature = "stats" ) ]
382
364
size : None ,
383
365
} ) ;
384
366
385
- if !interceptor. intercept ( ctx, cache ) {
367
+ if !interceptor. intercept_with_face ( ctx, face , & prefix ) {
386
368
return ;
387
369
}
388
370
} ;
@@ -420,24 +402,15 @@ pub fn route_data(
420
402
payload : msg. payload . clone ( ) ,
421
403
} ;
422
404
423
- if let Some ( interceptor) = face
424
- . state
425
- . eg_interceptors
426
- . as_ref ( )
427
- . map ( |i| i. load ( ) )
428
- . and_then ( |i| i. is_empty ( ) . not ( ) . then_some ( i) )
429
- {
430
- let cache_guard = prefix. get_ingress_cache ( face, & interceptor) ;
431
- let cache = cache_guard. as_ref ( ) . and_then ( |c| c. get_ref ( ) . as_ref ( ) ) ;
432
-
405
+ if let Some ( interceptor) = face. load_egress_interceptors ( ) {
433
406
let ctx = & mut RoutingContext :: new ( NetworkMessageMut {
434
407
body : NetworkBodyMut :: Push ( msg) ,
435
408
reliability,
436
409
#[ cfg( feature = "stats" ) ]
437
410
size : None ,
438
411
} ) ;
439
412
440
- if !interceptor. intercept ( ctx, cache ) {
413
+ if !interceptor. intercept_with_face ( ctx, face , & prefix ) {
441
414
continue ;
442
415
}
443
416
} ;
0 commit comments