diff --git a/src/liveliness.rs b/src/liveliness.rs index 0a7c689dd..c9d48c92d 100644 --- a/src/liveliness.rs +++ b/src/liveliness.rs @@ -173,7 +173,7 @@ pub extern "C" fn zc_liveliness_declare_subscriber( return z_owned_subscriber_t::null(); }; let callback = core::mem::replace(callback, z_owned_closure_sample_t::empty()); - match session + let res = session .liveliness() .declare_subscriber(key) .callback(move |sample| { @@ -185,8 +185,8 @@ pub extern "C" fn zc_liveliness_declare_subscriber( let sample = z_sample_t::new(&sample, &owner); z_closure_sample_call(&callback, &sample) }) - .res() - { + .res(); + match res { Ok(token) => z_owned_subscriber_t::new(token), Err(e) => { log::error!("Failed to subscribe to liveliness: {e}"); diff --git a/src/querying_subscriber.rs b/src/querying_subscriber.rs index d407f9646..d46792bca 100644 --- a/src/querying_subscriber.rs +++ b/src/querying_subscriber.rs @@ -202,7 +202,7 @@ pub unsafe extern "C" fn ze_declare_querying_subscriber( .query_timeout(std::time::Duration::from_millis(options.query_timeout_ms)); } } - match sub + let res = sub .callback(move |sample| { let payload = sample.payload.contiguous(); let owner = match payload { @@ -212,8 +212,8 @@ pub unsafe extern "C" fn ze_declare_querying_subscriber( let sample = z_sample_t::new(&sample, &owner); z_closure_sample_call(&closure, &sample) }) - .res() - { + .res(); + match res { Ok(sub) => ze_owned_querying_subscriber_t::new(sub, session), Err(e) => { log::debug!("{}", e);