Skip to content

Commit cca48c8

Browse files
authored
Lowlatency async finalize (#1894)
* Async finalize lowlatency transport when triggered from link to avoid deadlock (the same approach as it is done in unicast transport) * fix lints
1 parent ec07912 commit cca48c8

File tree

1 file changed

+10
-2
lines changed
  • io/zenoh-transport/src/unicast/lowlatency

1 file changed

+10
-2
lines changed

io/zenoh-transport/src/unicast/lowlatency/link.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ impl TransportUnicastLowlatency {
132132
c_transport.manager.config.zid,
133133
c_transport.config.zid
134134
);
135-
let _ = c_transport.finalize(0).await;
135+
136+
// Spawn a task to avoid a deadlock waiting for this same task
137+
// to finish in the close() joining its handle
138+
// WARN: Must be spawned on RX
139+
zenoh_runtime::ZRuntime::RX.spawn(async move { c_transport.finalize(0).await });
136140
}
137141
};
138142
self.tracker.spawn_on(task, &ZRuntime::TX);
@@ -202,7 +206,11 @@ impl TransportUnicastLowlatency {
202206
c_transport.manager.config.zid,
203207
c_transport.config.zid
204208
);
205-
let _ = c_transport.finalize(0).await;
209+
210+
// Spawn a task to avoid a deadlock waiting for this same task
211+
// to finish in the close() joining its handle
212+
// WARN: Must be spawned on RX
213+
zenoh_runtime::ZRuntime::RX.spawn(async move { c_transport.finalize(0).await });
206214
}
207215
},
208216
&ZRuntime::RX,

0 commit comments

Comments
 (0)