sireliah / dragit

Application for intuitive file sharing between devices.
GNU General Public License v3.0
140 stars 4 forks source link

Can't start second instance for testing #19

Closed tommis closed 2 years ago

tommis commented 2 years ago

On readme it states that it's possible to start two instances for testing purposes but when I try this on my machine I get the following.

[2022-05-04T22:00:43Z INFO  dragit::p2p] I am Peer: PeerId("12D3KooWAXeuYiZ1e2dPsk1KQnRZqdCEB2QjKuTqxhqfDYmW3PdT")
[2022-05-04T22:00:43Z ERROR dragit::dnd] Server error: Other(Custom { kind: Other, error: Other(A(A(Os { code: 98, kind: AddrInUse, message: "Address already in use" }))) })

(dragit:138943): Gtk-WARNING **: 01:00:43.106: Locale not supported by C library.
        Using the fallback 'C' locale.

First instance starts without problems.

sireliah commented 2 years ago

Yes, that's an issue that was caused by binding a port to a fixed value (~/.config/dragit/config.toml by default on Linux, if you're using Windows, this config will be in different place). This means that two instances are trying to listen on the same port.

I'll fix it, however before that I can offer you following, a bit hakish, solution:

  1. Set ~/.config/dragit/config.toml port value to 0, which will cause the application to pick a random port
  2. Run one instance of dragit (cargo run)
  3. Edit the src/dnd/mod.rs and change the application name to something else, for example "com.sireliah.Dragit2"
  4. Run another instance of dragit
  5. Profit

The step 3. is required, because Gtk applications cannot share the same name.

A bit less clumsy solution would be to use environment variable to preventing the recompilation of the application. But please try the steps above and tell if this worked!

sireliah commented 2 years ago

I'm closing this ticket, since it's now possible to test the app behaviour on a single machine. Please check the README!