fix: Services should not crash if already started

This commit is contained in:
zvonimir 2024-11-15 14:39:15 +01:00
parent 333f00235b
commit f938f79a35
2 changed files with 8 additions and 1 deletions

View file

@ -37,7 +37,10 @@ class ServiceDiscoverer(names: Array<String>, private val _onServicesUpdated: (L
}
fun start() {
if (_started) throw Exception("Already running.")
if (_started) {
Logger.i(TAG, "Already started.")
return
}
_started = true
val listener = MDNSListener()

View file

@ -66,6 +66,10 @@ class StateSync {
val deviceUpdatedOrAdded: Event2<String, SyncSession> = Event2()
fun start() {
if (_started) {
Logger.i(TAG, "Already started.")
return
}
_started = true
if (Settings.instance.synchronization.broadcast || Settings.instance.synchronization.connectDiscovered) {