Skip to content

Commit 5f940cb

Browse files
authored
zenoh-bridge-mqtt: fix Zenoh Runtime startup (#86)
1 parent 5717a79 commit 5f940cb

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

zenoh-bridge-mqtt/src/main.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ async fn main() {
215215
plugins_mgr = plugins_mgr.declare_static_plugin::<zenoh_plugin_mqtt::MqttPlugin>(true);
216216

217217
// create a zenoh Runtime.
218-
let runtime = match RuntimeBuilder::new(config)
218+
let mut runtime = match RuntimeBuilder::new(config)
219219
.plugins_manager(plugins_mgr)
220220
.build()
221221
.await
@@ -226,11 +226,10 @@ async fn main() {
226226
std::process::exit(-1);
227227
}
228228
};
229-
// create a zenoh Session.
230-
let _session = zenoh::init(runtime).res().await.unwrap_or_else(|e| {
231-
println!("{e}. Exiting...");
229+
if let Err(e) = runtime.start().await {
230+
println!("Failed to start Zenoh runtime: {e}. Exiting...");
232231
std::process::exit(-1);
233-
});
232+
}
234233

235234
async_std::future::pending::<()>().await;
236235
}

0 commit comments

Comments
 (0)