Skip to content

Commit

Permalink
Updated Zenoh subscriber and queryable declarations to undeclare enti…
Browse files Browse the repository at this point in the history
…ties when references are dropped. (#173)
  • Loading branch information
gmartin82 authored Oct 3, 2024
1 parent 540c1ad commit 64e9830
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions zenoh-plugin-ros1/examples/ros1_pub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ impl AlohaDeclaration {
.callback(move |_| {
rb.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
})
.undeclare_on_drop(true)
.await
.unwrap();

Expand Down
2 changes: 2 additions & 0 deletions zenoh-plugin-ros1/src/ros_to_zenoh_bridge/zenoh_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ impl ZenohClient {
self.session
.declare_subscriber(key_expr)
.callback(callback)
.undeclare_on_drop(true)
.allowed_origin(Locality::Remote)
.await
}
Expand Down Expand Up @@ -86,6 +87,7 @@ impl ZenohClient {
.declare_queryable(key_expr)
.allowed_origin(Locality::Remote)
.callback(callback)
.undeclare_on_drop(true)
.await
}

Expand Down
1 change: 1 addition & 0 deletions zenoh-plugin-ros1/tests/aloha_declaration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 64e9830

Please sign in to comment.