Skip to content

Commit

Permalink
zenoh::net::open() does not exit on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierHecart committed Jul 28, 2020
1 parent 7041a00 commit 89ee173
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion zenoh/src/net/mod.rs
Expand Up @@ -52,5 +52,5 @@ pub async fn scout(_iface: &str, _tries: usize, _period: usize) -> Vec<String> {
/// ```
pub async fn open(config: Config, ps: Option<Properties>) -> ZResult<Session> {
debug!("open(\"{}\", {:?})", config, ps);
Ok(Session::new(config, ps).await)
Session::new(config, ps).await
}
22 changes: 10 additions & 12 deletions zenoh/src/net/session.rs
Expand Up @@ -134,18 +134,16 @@ pub struct Session {
}

impl Session {
pub(super) async fn new(config: Config, _ps: Option<Properties>) -> Session {
let runtime = match Runtime::new(0, config).await {
Ok(runtime) => runtime,
_ => std::process::exit(-1),
};

let session = Self::init(runtime).await;

// Workaround for the declare_and_shoot problem
task::sleep(std::time::Duration::from_millis(200)).await;

session
pub(super) async fn new(config: Config, _ps: Option<Properties>) -> ZResult<Session> {
match Runtime::new(0, config).await {
Ok(runtime) => {
let session = Self::init(runtime).await;
// Workaround for the declare_and_shoot problem
task::sleep(std::time::Duration::from_millis(200)).await;
Ok(session)
}
Err(err) => Err(err),
}
}

/// Initialize a Session with an existing Runtime.
Expand Down

0 comments on commit 89ee173

Please sign in to comment.