From 851d2f4394b9b197fe066809bb230097cdf0ee3b Mon Sep 17 00:00:00 2001 From: OlivierHecart Date: Thu, 12 Oct 2023 11:17:39 +0200 Subject: [PATCH] Internal renaming --- zenoh/src/publication.rs | 14 +++++++------- zenoh/src/session.rs | 16 ++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/zenoh/src/publication.rs b/zenoh/src/publication.rs index dd16849640..7610abcde8 100644 --- a/zenoh/src/publication.rs +++ b/zenoh/src/publication.rs @@ -1053,11 +1053,11 @@ where let (callback, receiver) = self.handler.into_cb_receiver_pair(); self.publisher .session - .declare_matches_subscriber_inner(&self.publisher, callback) - .map(|sub_state| MatchingListener { - subscriber: MatchingListenerInner { + .declare_matches_listener_inner(&self.publisher, callback) + .map(|listener_state| MatchingListener { + listener: MatchingListenerInner { publisher: self.publisher, - state: sub_state, + state: listener_state, alive: true, }, receiver, @@ -1132,7 +1132,7 @@ impl<'a> Undeclarable<(), MatchingListenerUndeclaration<'a>> for MatchingListene /// ``` #[zenoh_macros::unstable] pub struct MatchingListener<'a, Receiver> { - pub(crate) subscriber: MatchingListenerInner<'a>, + pub(crate) listener: MatchingListenerInner<'a>, pub receiver: Receiver, } @@ -1156,14 +1156,14 @@ impl<'a, Receiver> MatchingListener<'a, Receiver> { /// ``` #[inline] pub fn undeclare(self) -> MatchingListenerUndeclaration<'a> { - self.subscriber.undeclare() + self.listener.undeclare() } } #[zenoh_macros::unstable] impl<'a, T> Undeclarable<(), MatchingListenerUndeclaration<'a>> for MatchingListener<'a, T> { fn undeclare_inner(self, _: ()) -> MatchingListenerUndeclaration<'a> { - Undeclarable::undeclare_inner(self.subscriber, ()) + Undeclarable::undeclare_inner(self.listener, ()) } } diff --git a/zenoh/src/session.rs b/zenoh/src/session.rs index 67094fc5d3..865959751f 100644 --- a/zenoh/src/session.rs +++ b/zenoh/src/session.rs @@ -1446,38 +1446,38 @@ impl Session { } #[zenoh_macros::unstable] - pub(crate) fn declare_matches_subscriber_inner( + pub(crate) fn declare_matches_listener_inner( &self, publisher: &Publisher, callback: Callback<'static, MatchingStatus>, ) -> ZResult> { let mut state = zwrite!(self.state); - log::trace!("matches_subscriber({:?})", publisher.key_expr); + log::trace!("matches_listener({:?})", publisher.key_expr); let id = state.decl_id_counter.fetch_add(1, Ordering::SeqCst); - let sub_state = Arc::new(MatchingListenerState { + let listener_state = Arc::new(MatchingListenerState { id, current: std::sync::Mutex::new(false), destination: publisher.destination, key_expr: publisher.key_expr.clone().into_owned(), callback, }); - state.matching_listeners.insert(id, sub_state.clone()); + state.matching_listeners.insert(id, listener_state.clone()); drop(state); - match sub_state.current.lock() { + match listener_state.current.lock() { Ok(mut current) => { if self - .matching_status(&publisher.key_expr, sub_state.destination) + .matching_status(&publisher.key_expr, listener_state.destination) .map(|s| s.is_matching()) .unwrap_or(true) { *current = true; - (sub_state.callback)(MatchingStatus { matching: true }); + (listener_state.callback)(MatchingStatus { matching: true }); } } Err(e) => log::error!("Error trying to acquire MathginListener lock: {}", e), } - Ok(sub_state) + Ok(listener_state) } #[zenoh_macros::unstable]