mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-08-08 09:09:48 +00:00
Dont lock clients when disabling
This commit is contained in:
parent
b9239b6177
commit
01cb544dfd
1 changed files with 6 additions and 5 deletions
|
@ -395,8 +395,9 @@ class StatePlatform {
|
||||||
}
|
}
|
||||||
suspend fun selectClients(afterLoad: (() -> Unit)?, vararg ids: String) {
|
suspend fun selectClients(afterLoad: (() -> Unit)?, vararg ids: String) {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
|
var removed: MutableList<IPlatformClient>;
|
||||||
synchronized(_clientsLock) {
|
synchronized(_clientsLock) {
|
||||||
val removed = _enabledClients.toMutableList();
|
removed = _enabledClients.toMutableList();
|
||||||
_enabledClients.clear();
|
_enabledClients.clear();
|
||||||
for (id in ids) {
|
for (id in ids) {
|
||||||
val client = getClient(id);
|
val client = getClient(id);
|
||||||
|
@ -412,11 +413,11 @@ class StatePlatform {
|
||||||
}
|
}
|
||||||
_enabledClientsPersistent.set(*ids);
|
_enabledClientsPersistent.set(*ids);
|
||||||
_enabledClientsPersistent.save();
|
_enabledClientsPersistent.save();
|
||||||
|
}
|
||||||
|
|
||||||
for (oldClient in removed) {
|
for (oldClient in removed) {
|
||||||
oldClient.disable();
|
oldClient.disable();
|
||||||
onSourceDisabled.emit(oldClient);
|
onSourceDisabled.emit(oldClient);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
afterLoad?.invoke();
|
afterLoad?.invoke();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue