Skip to content

Commit 252f6a8

Browse files
authored
Fix Session::close timeout while client attempts to reconnect (#2012)
* Evaluate Runtime cancellation concurrently with start_client * Use runtime.spawn_abortable instead of manually managing cancellation token
1 parent bd84c64 commit 252f6a8

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

zenoh/src/net/runtime/orchestrator.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,16 +1199,11 @@ impl Runtime {
11991199
match session.runtime.whatami() {
12001200
WhatAmI::Client => {
12011201
let runtime = session.runtime.clone();
1202-
let cancellation_token = runtime.get_cancellation_token();
1203-
1204-
session.runtime.spawn(async move {
1202+
session.runtime.spawn_abortable(async move {
12051203
let retry_config = runtime.get_global_connect_retry_config();
12061204
let mut period = retry_config.period();
12071205
while runtime.start_client().await.is_err() {
1208-
tokio::select! {
1209-
_ = tokio::time::sleep(period.next_duration()) => {}
1210-
_ = cancellation_token.cancelled() => { break; }
1211-
}
1206+
tokio::time::sleep(period.next_duration()).await;
12121207
}
12131208
});
12141209
}

0 commit comments

Comments
 (0)