Skip to content

Commit a4a8bc8

Browse files
committed
Reimplement liveliness with interests
1 parent 82293b2 commit a4a8bc8

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

zenoh/src/session.rs

+35-1
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,23 @@ impl Session {
11131113
let state = zread!(self.state);
11141114
self.update_status_up(&state, &key_expr)
11151115
}
1116+
} else if key_expr
1117+
.as_str()
1118+
.starts_with(crate::liveliness::PREFIX_LIVELINESS)
1119+
{
1120+
let primitives = state.primitives.as_ref().unwrap().clone();
1121+
drop(state);
1122+
1123+
primitives.send_declare(Declare {
1124+
ext_qos: declare::ext::QoSType::DECLARE,
1125+
ext_tstamp: None,
1126+
ext_nodeid: declare::ext::NodeIdType::DEFAULT,
1127+
body: DeclareBody::DeclareInterest(DeclareInterest {
1128+
id,
1129+
wire_expr: Some(key_expr.to_wire(self).to_owned()),
1130+
interest: Interest::KEYEXPRS + Interest::SUBSCRIBERS + Interest::FUTURE,
1131+
}),
1132+
});
11161133
}
11171134

11181135
Ok(sub_state)
@@ -1170,6 +1187,23 @@ impl Session {
11701187
self.update_status_down(&state, &sub_state.key_expr)
11711188
}
11721189
}
1190+
} else if sub_state
1191+
.key_expr
1192+
.as_str()
1193+
.starts_with(crate::liveliness::PREFIX_LIVELINESS)
1194+
{
1195+
let primitives = state.primitives.as_ref().unwrap().clone();
1196+
drop(state);
1197+
1198+
primitives.send_declare(Declare {
1199+
ext_qos: declare::ext::QoSType::DECLARE,
1200+
ext_tstamp: None,
1201+
ext_nodeid: declare::ext::NodeIdType::DEFAULT,
1202+
body: DeclareBody::UndeclareInterest(UndeclareInterest {
1203+
id: sub_state.id,
1204+
ext_wire_expr: WireExprType::null(),
1205+
}),
1206+
});
11731207
}
11741208
Ok(())
11751209
} else {
@@ -2026,7 +2060,7 @@ impl Primitives for Session {
20262060
};
20272061
self.handle_data(
20282062
false,
2029-
&m.ext_wire_expr.wire_expr,
2063+
&expr.to_wire(self),
20302064
Some(data_info),
20312065
ZBuf::default(),
20322066
#[cfg(feature = "unstable")]

0 commit comments

Comments
 (0)