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

Expose Quality of Service settings (Priority, Congestion Control, Express) the Sample was published with #730

Merged
merged 14 commits into from
Feb 23, 2024
Merged
15 changes: 10 additions & 5 deletions zenoh/src/sample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,14 +528,19 @@ pub struct QoS {
}

impl QoS {
/// Helper function to fallback to default QoS value and log a error in case of conversion failure
/// Helper function to fallback to QoS with default priortiy value, in case we fail to extract it
pub(crate) fn from_or_default(ext: QoSType) -> QoS {
Mallets marked this conversation as resolved.
Show resolved Hide resolved
match QoS::try_from(ext) {
Ok(qos) => return qos,
let priority = match Priority::try_from(ext.get_priority()) {
Ok(p) => p,
Err(e) => {
log::error!("Failed to convert: {}", e.to_string());
QoS::default()
log::error!("Failed to convert priority: {}", e.to_string());
Mallets marked this conversation as resolved.
Show resolved Hide resolved
Priority::default()
}
};
QoS {
priority,
congestion_control: ext.get_congestion_control(),
express: ext.is_express(),
}
}
}
Expand Down