Skip to content

Commit

Permalink
Merge pull request #1391 from eclipse-zenoh/fix-zombie-orchestrator
Browse files Browse the repository at this point in the history
Fix orchestrator not dying after being killed
  • Loading branch information
Mallets authored Sep 10, 2024
2 parents 16ddfad + 00837d3 commit 485194b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions zenoh/src/net/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,13 @@ impl Runtime {
Ok(())
}

pub fn is_closed(&self) -> bool {
self.state
.task_controller
.get_cancellation_token()
.is_cancelled()
}

pub fn new_timestamp(&self) -> Option<uhlc::Timestamp> {
self.state.hlc.as_ref().map(|hlc| hlc.new_timestamp())
}
Expand Down
5 changes: 5 additions & 0 deletions zenoh/src/net/runtime/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1137,10 +1137,15 @@ impl Runtime {
}

pub(super) fn closing_session(session: &RuntimeSession) {
if session.runtime.is_closed() {
return;
}

match session.runtime.whatami() {
WhatAmI::Client => {
let runtime = session.runtime.clone();
let cancellation_token = runtime.get_cancellation_token();

session.runtime.spawn(async move {
let retry_config = runtime.get_global_connect_retry_config();
let mut period = retry_config.period();
Expand Down

0 comments on commit 485194b

Please sign in to comment.