slskd icon indicating copy to clipboard operation
slskd copied to clipboard

Add a mutex to prevent multiple instances of slskd from running on the same machine

Open jpdillingham opened this issue 2 years ago • 2 comments

There's no good-faith use case for running more than one instance of slskd concurrently on the same system. Add a mutex to ensure good-faith usage.

jpdillingham avatar Sep 08 '22 23:09 jpdillingham

Could you please assign this issue to me? Would love to work on it.

skar07 avatar Oct 02 '22 13:10 skar07

Sure thing!

This Stack Overflow answer should be helpful: https://stackoverflow.com/questions/2186747/how-can-i-create-a-system-mutex-in-c-sharp

For the name I think AppName should work well enough.

Right around this line would be a good place to add the logic. The app should be able to be run in command mode if it's already running, but if it is starting as a daemon we'll want to obtain the mutex/check it.

jpdillingham avatar Oct 02 '22 14:10 jpdillingham