diff --git a/zenoh-plugin-ros1/examples/ros1_pub.rs b/zenoh-plugin-ros1/examples/ros1_pub.rs index b3883d0..23357a7 100644 --- a/zenoh-plugin-ros1/examples/ros1_pub.rs +++ b/zenoh-plugin-ros1/examples/ros1_pub.rs @@ -60,6 +60,7 @@ async fn main() { let zenoh_subscriber = zenoh_session .declare_subscriber("some/ros/topic") .callback(|data| println!("Zenoh Subscriber: got data!")) + .undeclare_on_drop(true) .await .unwrap(); println!(" OK!"); diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/aloha_declaration.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/aloha_declaration.rs index 05a7913..0ba7f63 100644 --- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/aloha_declaration.rs +++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/aloha_declaration.rs @@ -68,6 +68,7 @@ impl AlohaDeclaration { .callback(move |_| { rb.fetch_add(1, std::sync::atomic::Ordering::SeqCst); }) + .undeclare_on_drop(true) .await .unwrap(); diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/zenoh_client.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/zenoh_client.rs index 3890be9..fbfaba2 100644 --- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/zenoh_client.rs +++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/zenoh_client.rs @@ -48,6 +48,7 @@ impl ZenohClient { self.session .declare_subscriber(key_expr) .callback(callback) + .undeclare_on_drop(true) .allowed_origin(Locality::Remote) .await } @@ -86,6 +87,7 @@ impl ZenohClient { .declare_queryable(key_expr) .allowed_origin(Locality::Remote) .callback(callback) + .undeclare_on_drop(true) .await } diff --git a/zenoh-plugin-ros1/tests/aloha_declaration_test.rs b/zenoh-plugin-ros1/tests/aloha_declaration_test.rs index 2bf6897..4dba8e0 100644 --- a/zenoh-plugin-ros1/tests/aloha_declaration_test.rs +++ b/zenoh-plugin-ros1/tests/aloha_declaration_test.rs @@ -110,6 +110,7 @@ impl PPCMeasurement { .callback(move |_val| { p.fetch_add(1, std::sync::atomic::Ordering::SeqCst); }) + .undeclare_on_drop(true) .await?; Ok(Self {