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: properly apply z_get_options_t in ze_querying_subscriber_get #621

Merged
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
25 changes: 17 additions & 8 deletions src/querying_subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::mem::MaybeUninit;

use zenoh::{
bytes::EncodingBuilderTrait, prelude::SessionDeclarations, pubsub::Reliability,
sample::SampleBuilderTrait, session::Session, Wait,
qos::QoSBuilderTrait, sample::SampleBuilderTrait, session::Session, Wait,
};
use zenoh_ext::*;

Expand Down Expand Up @@ -170,7 +170,7 @@ pub unsafe extern "C" fn ze_querying_subscriber_get(
.0
.fetch({
move |cb| {
let mut get = session.get(selector).callback(cb);
let mut get = session.get(selector);

if let Some(options) = options {
if let Some(payload) = options.payload.take() {
Expand All @@ -179,24 +179,33 @@ pub unsafe extern "C" fn ze_querying_subscriber_get(
if let Some(encoding) = options.encoding.take() {
get = get.encoding(encoding.take_rust_type());
}
#[cfg(feature = "unstable")]
if let Some(source_info) = options.source_info.take() {
get = get.source_info(source_info.take_rust_type());
}
if let Some(attachment) = options.attachment.take() {
get = get.attachment(attachment.take_rust_type());
}

get = get
.consolidation(options.consolidation)
.target(options.target.into());
.target(options.target.into())
.congestion_control(options.congestion_control.into())
.priority(options.priority.into())
.express(options.is_express);

#[cfg(feature = "unstable")]
{
if let Some(source_info) = options.source_info.take() {
get = get.source_info(source_info.take_rust_type());
}
get = get
.allowed_destination(options.allowed_destination.into())
.accept_replies(options.accept_replies.into());
}

if options.timeout_ms != 0 {
get = get.timeout(std::time::Duration::from_millis(options.timeout_ms));
}
}

get.wait()
get.callback(cb).wait()
}
})
.wait()
Expand Down