FabianLars/tauri-plugin-deep-link

windows: Panic if 2 Windows users try to have the same app running at the same time

ReactorScram opened this issue · 0 comments

Saw this over on the Firezone client: firezone/firezone#2808

The 2nd app instance panics here:

.expect("Can't create listener");

I'm guessing what happens is, when prepare tries to connect to the listening socket owned by the other Windows user, it fails, so it believes the 2nd instance is actually the 1st instance.

But then when register tries to open the socket and listen for itself, it fails because they're in the same namespace.

I thought of a few possible patches, but it's not critical for our project so I haven't started on any:

  1. Move the bind out of the worker thread and change the expect into returning an error before the worker thread is started. This means you can't run the app in 2 Windows sessions at once, but at least it won't panic in the worker thread
  2. Add the user's ID into the socket's ID so that you can have 2 separate sockets, but only one per user.