libparsec's client_start
while client_stop
is running on the same device not properly handled
#8586
Labels
A-Client
Area: Parsec desktop application
enhancement
Improve functionality, potentially changing behavior
I-Rust
Impact: Rust-related stuff
parsec-cloud/libparsec/src/client.rs
Lines 208 to 231 in 8bfd773
So
client_stop
first unregisters the handle, then proceeds to do the actual closing of the client.On top of that the closing involve asynchronous operation (i.e.
client.stop().await
) which may take time.So if a concurrent
client_start
comes for the same device, it will try to start the client right away and:device_in_use_guard
is still held while the client is being stopped.It would be better to instead have a dedicated error for client being stopped with an event as parameter to know when the stop is done (this is basically what we already do when calling a
client_start
for a device that is currently being started).To do that I guess we would need to introduce a
take_and_close_handle_with_teardown
just like we have aregister_handle_with_init
The text was updated successfully, but these errors were encountered: