Skip to content

Commit

Permalink
merge protocol changes followup
Browse files Browse the repository at this point in the history
  • Loading branch information
milyin committed Apr 22, 2024
1 parent 52d38e6 commit f98436a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
2 changes: 2 additions & 0 deletions zenoh/src/api/scouting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ fn _scout(
/// # #[tokio::main]
/// # async fn main() {
/// use zenoh::prelude::r#async::*;
/// use zenoh::scouting::WhatAmI;
///
/// let receiver = zenoh::scout(WhatAmI::Peer | WhatAmI::Router, config::default())
/// .res()
Expand All @@ -376,3 +377,4 @@ where
handler: DefaultHandler::default(),
}
}

27 changes: 25 additions & 2 deletions zenoh/src/api/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2664,7 +2664,11 @@ where
TryIntoConfig: std::convert::TryInto<crate::config::Config> + Send + 'static,
<TryIntoConfig as std::convert::TryInto<crate::config::Config>>::Error: std::fmt::Debug,
{
OpenBuilder { config }
OpenBuilder {
config,
#[cfg(all(feature = "unstable", feature = "shared-memory"))]
shm_clients: None,
}
}

/// A builder returned by [`open`] used to open a zenoh [`Session`].
Expand All @@ -2685,6 +2689,20 @@ where
<TryIntoConfig as std::convert::TryInto<crate::config::Config>>::Error: std::fmt::Debug,
{
config: TryIntoConfig,
#[cfg(all(feature = "unstable", feature = "shared-memory"))]
shm_clients: Option<Arc<SharedMemoryClientStorage>>,
}

#[cfg(all(feature = "unstable", feature = "shared-memory"))]
impl<TryIntoConfig> OpenBuilder<TryIntoConfig>
where
TryIntoConfig: std::convert::TryInto<crate::config::Config> + Send + 'static,
<TryIntoConfig as std::convert::TryInto<crate::config::Config>>::Error: std::fmt::Debug,
{
pub fn with_shm_clients(mut self, shm_clients: Arc<SharedMemoryClientStorage>) -> Self {
self.shm_clients = Some(shm_clients);
self
}
}

impl<TryIntoConfig> Resolvable for OpenBuilder<TryIntoConfig>
Expand All @@ -2705,7 +2723,12 @@ where
.config
.try_into()
.map_err(|e| zerror!("Invalid Zenoh configuration {:?}", &e))?;
Session::new(config).res_sync()
Session::new(
config,
#[cfg(all(feature = "unstable", feature = "shared-memory"))]
self.shm_clients,
)
.res_sync()
}
}

Expand Down

0 comments on commit f98436a

Please sign in to comment.