mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor: handle closing NsdManager service discovery if already stopped
This commit is contained in:
parent
55ae55a817
commit
6a0d9b523b
1 changed files with 7 additions and 1 deletions
|
|
@ -56,7 +56,13 @@ private fun NsdManager.discoverServices(
|
|||
trySend(emptyList()) // Emit an initial empty list
|
||||
discoverServices(serviceType, protocolType, discoveryListener)
|
||||
|
||||
awaitClose { stopServiceDiscovery(discoveryListener) }
|
||||
awaitClose {
|
||||
try {
|
||||
stopServiceDiscovery(discoveryListener)
|
||||
} catch (ex: IllegalArgumentException) {
|
||||
// ignore if discovery is already stopped
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun NsdManager.resolveService(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue