Skip to content

Commit b565e89

Browse files
committed
Fix more tests and obscure features
1 parent 51ab6e2 commit b565e89

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

zenoh/src/net/routing/dispatcher/pubsub.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ pub fn route_data(
312312
let ctx = &mut RoutingContext::new(NetworkMessageMut {
313313
body: NetworkBodyMut::Push(msg),
314314
reliability,
315+
#[cfg(feature = "stats")]
316+
size: None,
315317
});
316318

317319
if !interceptor.intercept(ctx, cache) {
@@ -325,9 +327,9 @@ pub fn route_data(
325327
let admin = expr.full_expr().starts_with("@/");
326328
#[cfg(feature = "stats")]
327329
if !admin {
328-
inc_stats!(face, rx, user, msg.payload);
330+
inc_stats!(face.state, rx, user, msg.payload);
329331
} else {
330-
inc_stats!(face, rx, admin, msg.payload);
332+
inc_stats!(face.state, rx, admin, msg.payload);
331333
}
332334

333335
if tables
@@ -376,6 +378,8 @@ pub fn route_data(
376378
let ctx = &mut RoutingContext::new(NetworkMessageMut {
377379
body: NetworkBodyMut::Push(msg),
378380
reliability,
381+
#[cfg(feature = "stats")]
382+
size: None,
379383
});
380384

381385
if !interceptor.intercept(ctx, cache) {
@@ -429,6 +433,8 @@ pub fn route_data(
429433
let ctx = &mut RoutingContext::new(NetworkMessageMut {
430434
body: NetworkBodyMut::Push(msg),
431435
reliability,
436+
#[cfg(feature = "stats")]
437+
size: None,
432438
});
433439

434440
if !interceptor.intercept(ctx, cache) {

zenoh/src/tests.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::str::FromStr;
1616

1717
use zenoh_buffers::ZBuf;
1818
use zenoh_protocol::{
19-
network::{NetworkBody, NetworkMessage, Push},
19+
network::{NetworkBodyMut, NetworkMessageMut, Push},
2020
zenoh::PushBody,
2121
};
2222
use zenoh_transport::{multicast::TransportMulticast, unicast::TransportUnicast};
@@ -96,18 +96,18 @@ impl InterceptorTrait for TestInterceptor {
9696

9797
fn intercept(
9898
&self,
99-
mut ctx: RoutingContext<NetworkMessage>,
99+
ctx: &mut RoutingContext<NetworkMessageMut<'_>>,
100100
cache: Option<&Box<dyn Any + Send + Sync>>,
101-
) -> Option<RoutingContext<NetworkMessage>> {
102-
if let NetworkBody::Push(Push {
103-
payload: PushBody::Put(p),
101+
) -> bool {
102+
if let NetworkBodyMut::Push(&mut Push {
103+
payload: PushBody::Put(ref mut p),
104104
..
105105
}) = &mut ctx.msg.body
106106
{
107107
let out = format!("Cache hit: {}, data: {}", cache.is_some(), &self.data);
108108
p.payload = ZBuf::from(out.as_bytes().to_owned());
109109
}
110-
Some(ctx)
110+
true
111111
}
112112
}
113113

0 commit comments

Comments
 (0)