Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix forgotten QoS and Timestamp ext processing for query/reply #1108

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions commons/zenoh-protocol/src/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ pub mod imsg {
byte
}

pub const fn set_bitfield(mut byte: u8, value: u8, mask: u8) -> u8 {
byte = unset_flag(byte, mask);
byte |= value;
byte
}

pub const fn has_option(options: u64, flag: u64) -> bool {
options & flag != 0
}
Expand Down
2 changes: 1 addition & 1 deletion commons/zenoh-protocol/src/network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ pub mod ext {
}

pub fn set_priority(&mut self, priority: Priority) {
self.inner = imsg::set_flag(self.inner, priority as u8);
self.inner = imsg::set_bitfield(self.inner, priority as u8, Self::P_MASK);
}

pub const fn get_priority(&self) -> Priority {
Expand Down
4 changes: 4 additions & 0 deletions zenoh/src/net/routing/dispatcher/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ impl Primitives for Face {
&self.state,
&msg.wire_expr,
msg.id,
msg.ext_qos,
msg.ext_tstamp,
msg.ext_target,
msg.ext_budget,
msg.ext_timeout,
Expand All @@ -385,6 +387,8 @@ impl Primitives for Face {
&self.tables,
&mut self.state.clone(),
msg.rid,
msg.ext_qos,
msg.ext_tstamp,
msg.ext_respid,
msg.wire_expr,
msg.payload,
Expand Down
15 changes: 11 additions & 4 deletions zenoh/src/net/routing/dispatcher/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ impl Timed for QueryCleanup {
&self.tables,
&mut face,
self.qid,
response::ext::QoSType::RESPONSE,
None,
ext_respid,
WireExpr::empty(),
ResponseBody::Err(zenoh::Err {
Expand Down Expand Up @@ -609,6 +611,8 @@ pub fn route_query(
face: &Arc<FaceState>,
expr: &WireExpr,
qid: RequestId,
ext_qos: ext::QoSType,
ext_tstamp: Option<ext::TimestampType>,
ext_target: TargetType,
ext_budget: Option<BudgetType>,
ext_timeout: Option<TimeoutType>,
Expand Down Expand Up @@ -733,8 +737,8 @@ pub fn route_query(
Request {
id: *qid,
wire_expr: key_expr.into(),
ext_qos: ext::QoSType::REQUEST,
ext_tstamp: None,
ext_qos,
ext_tstamp,
ext_nodeid: ext::NodeIdType { node_id: *context },
ext_target,
ext_budget,
Expand Down Expand Up @@ -781,10 +785,13 @@ pub fn route_query(
}
}

#[allow(clippy::too_many_arguments)]
pub(crate) fn route_send_response(
tables_ref: &Arc<TablesLock>,
face: &mut Arc<FaceState>,
qid: RequestId,
ext_qos: ext::QoSType,
ext_tstamp: Option<ext::TimestampType>,
ext_respid: Option<ResponderIdType>,
key_expr: WireExpr,
body: ResponseBody,
Expand Down Expand Up @@ -819,8 +826,8 @@ pub(crate) fn route_send_response(
rid: query.src_qid,
wire_expr: key_expr.to_owned(),
payload: body,
ext_qos: response::ext::QoSType::RESPONSE,
ext_tstamp: None,
ext_qos,
ext_tstamp,
ext_respid,
},
"".to_string(), // @TODO provide the proper key expression of the response for interceptors
Expand Down
Loading