diff --git a/Cargo.lock b/Cargo.lock index 27d0229..2a60a7d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4054,7 +4054,7 @@ dependencies = [ [[package]] name = "zenoh" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "async-global-executor", "async-std", @@ -4118,7 +4118,7 @@ dependencies = [ [[package]] name = "zenoh-buffers" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "zenoh-collections", ] @@ -4126,7 +4126,7 @@ dependencies = [ [[package]] name = "zenoh-codec" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "log", "serde", @@ -4138,12 +4138,12 @@ dependencies = [ [[package]] name = "zenoh-collections" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" [[package]] name = "zenoh-config" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "flume", "json5", @@ -4161,7 +4161,7 @@ dependencies = [ [[package]] name = "zenoh-core" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "async-std", "lazy_static", @@ -4171,7 +4171,7 @@ dependencies = [ [[package]] name = "zenoh-crypto" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "aes 0.8.3", "hmac 0.12.1", @@ -4184,7 +4184,7 @@ dependencies = [ [[package]] name = "zenoh-ext" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "async-std", "bincode", @@ -4204,7 +4204,7 @@ dependencies = [ [[package]] name = "zenoh-keyexpr" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "hashbrown 0.14.0", "keyed-set", @@ -4218,7 +4218,7 @@ dependencies = [ [[package]] name = "zenoh-link" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "async-std", "async-trait", @@ -4237,7 +4237,7 @@ dependencies = [ [[package]] name = "zenoh-link-commons" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "async-std", "async-trait", @@ -4253,7 +4253,7 @@ dependencies = [ [[package]] name = "zenoh-link-quic" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "async-rustls", "async-std", @@ -4277,7 +4277,7 @@ dependencies = [ [[package]] name = "zenoh-link-tcp" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "async-std", "async-trait", @@ -4293,7 +4293,7 @@ dependencies = [ [[package]] name = "zenoh-link-tls" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "async-rustls", "async-std", @@ -4316,7 +4316,7 @@ dependencies = [ [[package]] name = "zenoh-link-udp" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "async-std", "async-trait", @@ -4335,7 +4335,7 @@ dependencies = [ [[package]] name = "zenoh-link-unixsock_stream" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "async-std", "async-trait", @@ -4353,7 +4353,7 @@ dependencies = [ [[package]] name = "zenoh-link-ws" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "async-std", "async-trait", @@ -4373,7 +4373,7 @@ dependencies = [ [[package]] name = "zenoh-macros" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "proc-macro2", "quote", @@ -4386,7 +4386,7 @@ dependencies = [ [[package]] name = "zenoh-plugin-rest" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "anyhow", "async-std", @@ -4443,7 +4443,7 @@ dependencies = [ [[package]] name = "zenoh-plugin-trait" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "libloading 0.8.0", "log", @@ -4456,7 +4456,7 @@ dependencies = [ [[package]] name = "zenoh-protocol" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "const_format", "hex", @@ -4472,7 +4472,7 @@ dependencies = [ [[package]] name = "zenoh-result" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "anyhow", ] @@ -4480,7 +4480,7 @@ dependencies = [ [[package]] name = "zenoh-sync" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "async-std", "event-listener", @@ -4495,7 +4495,7 @@ dependencies = [ [[package]] name = "zenoh-transport" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "async-executor", "async-global-executor", @@ -4526,7 +4526,7 @@ dependencies = [ [[package]] name = "zenoh-util" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#819f53e9685978167d63fbc750c3d6b8400691a5" +source = "git+https://github.com/eclipse-zenoh/zenoh?branch=matching_state#5d2ee158f6329f0d44c78706022da9f28f8af8be" dependencies = [ "async-std", "async-trait", diff --git a/zenoh-plugin-ros2dds/src/route_publisher.rs b/zenoh-plugin-ros2dds/src/route_publisher.rs index 82369d9..ebec0cf 100644 --- a/zenoh-plugin-ros2dds/src/route_publisher.rs +++ b/zenoh-plugin-ros2dds/src/route_publisher.rs @@ -54,13 +54,6 @@ impl Deref for ZPublisher { } } -// struct InnerState<'a> { -// TODO? solution to create empty route, and then add an InnerState after containing -// ZPublisher + dds_reader Atomic + Matching Listener that create DDS Reader -// -// not sure it solves since anyway MatchingListener holds a &Publisher -// } - // a route from DDS to Zenoh #[allow(clippy::upper_case_acronyms)] #[derive(Serialize)] @@ -86,7 +79,7 @@ pub struct RoutePublisher<'a> { dds_reader: Arc, // TypeInfo for Reader creation (if available) #[serde(skip)] - type_info: Option>, + _type_info: Option>, // if the topic is keyless #[serde(skip)] keyless: bool, @@ -94,7 +87,7 @@ pub struct RoutePublisher<'a> { // those are either the QoS announced by a remote bridge on a Reader discovery, // either the QoS adapted from a local disovered Writer #[serde(skip)] - reader_qos: Qos, + _reader_qos: Qos, // a liveliness token associated to this route, for announcement to other plugins #[serde(skip)] liveliness_token: Option>, @@ -269,8 +262,8 @@ impl RoutePublisher<'_> { cache_size, }, dds_reader, - type_info: type_info.clone(), - reader_qos, + _type_info: type_info.clone(), + _reader_qos: reader_qos, keyless, liveliness_token: None, remote_routes: HashSet::new(), @@ -278,46 +271,6 @@ impl RoutePublisher<'_> { }) } - fn activate_dds_reader(&mut self) -> Result<(), String> { - let topic_name = format!("rt{}", self.ros2_name); - let type_name = ros2_message_type_to_dds_type(&self.ros2_type); - let read_period = get_read_period(&self.context.config, &self.zenoh_key_expr); - let route_id = self.to_string(); - let publisher = self.zenoh_publisher.clone(); - - // create matching DDS Reader that forwards data coming from DDS to Zenoh - let dds_reader = create_dds_reader( - self.context.participant, - topic_name, - type_name, - &self.type_info, - self.keyless, - self.reader_qos.clone(), - read_period, - move |sample: &DDSRawSample| { - do_route_message( - sample, &publisher, - // &self.zenoh_key_expr, - // &self.context.zsession, - &route_id, - ); - }, - )?; - let old = self.dds_reader.swap(dds_reader, Ordering::Relaxed); - if old != DDS_ENTITY_NULL { - if let Err(e) = delete_dds_entity(old) { - log::warn!("{self}: failed to delete overwritten DDS Reader: {e}"); - } - } - - // add reader's GID in ros_discovery_info message - self.context - .ros_discovery_mgr - .add_dds_reader(get_guid(&dds_reader)?); - - Ok(()) - } - fn deactivate_dds_reader(&mut self) { let dds_reader = self.dds_reader.swap(DDS_ENTITY_NULL, Ordering::Relaxed); if dds_reader != DDS_ENTITY_NULL { @@ -368,12 +321,6 @@ impl RoutePublisher<'_> { self.remote_routes .insert(format!("{plugin_id}:{zenoh_key_expr}")); log::debug!("{self} now serving remote routes {:?}", self.remote_routes); - // if 1st remote route added, activate the DDS Reader - if self.remote_routes.len() == 1 { - if let Err(e) = self.activate_dds_reader() { - log::error!("{self} activation of DDS Reader failed: {e}"); - } - } } #[inline] @@ -462,7 +409,7 @@ fn activate_dds_reader( // create matching DDS Reader that forwards data coming from DDS to Zenoh let reader = create_dds_reader( context.participant, - topic_name, + topic_name.clone(), type_name, type_info, keyless,