Keep failed settings teardown retryable and preserve UI until database stop succeeds
This commit is contained in:
1 parent
c5c4d0e588
commit
828b36f290
2 files changed
+14
-8
No files matched your search
@@ -67,8 +67,8 @@ object NativeLib {
|
||||
}
|
||||
|
||||
fun restart(dbPath: String, controlPort: Int, configText: String): Boolean {
|
||||
prepareForCoreStop()
|
||||
return nativeRestart(configText).also { coreStopping = false }
|
||||
try { prepareForCoreStop(); return nativeRestart(configText) }
|
||||
finally { coreStopping = false }
|
||||
}
|
||||
|
||||
/** Снять frontend-владельцев перед stop/restart/сменой ключей. Неподтверждённый CallService либо ещё
|
||||
@@ -95,7 +95,7 @@ object NativeLib {
|
||||
return nativeUpdateSockets(configText)
|
||||
}
|
||||
|
||||
fun isReady(): Boolean = !coreStopping && nativeIsRunning()
|
||||
fun isReady(): Boolean = nativeIsRunning()
|
||||
|
||||
fun getMyNodeId(): Long = nativeGetMyNodeId()
|
||||
|
||||
@@ -154,8 +154,8 @@ object NativeLib {
|
||||
fun setUdpLogTarget(ip: String, port: Int) { nativeSetUdpLogTarget(ip, port) }
|
||||
/** Принимает полный INI для пересоздания ядра с новой сохранённой идентичностью; true подтверждает приём запроса. */
|
||||
fun regenerateKeys(configText: String): Boolean {
|
||||
prepareForCoreStop()
|
||||
return nativeRegenerateKeys(configText).also { coreStopping = false }
|
||||
try { prepareForCoreStop(); return nativeRegenerateKeys(configText) }
|
||||
finally { coreStopping = false }
|
||||
}
|
||||
|
||||
/* ── Channel members ── */
|
||||
@@ -315,8 +315,14 @@ object NativeLib {
|
||||
|
||||
/* ── P2P аудио-звонок (сигналинг) ── */
|
||||
/** true — копия команды принята живым worker; результат согласования приходит CALL_* событием. */
|
||||
fun callStart(channelId: String, peerNodeId: Long, callId: Long): Boolean = nativeCallStart(channelId, peerNodeId, callId)
|
||||
fun callAccept(callId: Long): Boolean = nativeCallAccept(callId)
|
||||
fun callStart(channelId: String, peerNodeId: Long, callId: Long): Boolean {
|
||||
if (coreStopping) { LogManager.addLog("WARN", "Call", "Start rejected during core teardown id=$callId"); return false }
|
||||
return nativeCallStart(channelId, peerNodeId, callId)
|
||||
}
|
||||
fun callAccept(callId: Long): Boolean {
|
||||
if (coreStopping) { LogManager.addLog("WARN", "Call", "Accept rejected during core teardown id=$callId"); return false }
|
||||
return nativeCallAccept(callId)
|
||||
}
|
||||
fun callDecline(callId: Long): Boolean = nativeCallDecline(callId)
|
||||
fun callHangup(callId: Long): Boolean = nativeCallHangup(callId)
|
||||
fun callContinue(callId: Long): Boolean = nativeCallContinue(callId)
|
||||
|
||||
@@ -1866,10 +1866,10 @@ class ChatViewModel : ViewModel() {
|
||||
viewModelScope.launch {
|
||||
try {
|
||||
HeadlessService.awaitStartup()
|
||||
clearState()
|
||||
withContext(Dispatchers.IO) {
|
||||
val wasRunning = NativeLib.isReady()
|
||||
NativeLib.stop()
|
||||
withContext(Dispatchers.Main) { clearState() }
|
||||
val cleared = NativeLib.clearDatabase()
|
||||
if (!cleared) LogManager.addLog("ERROR", "CFG", "database reset rejected by native backend")
|
||||
if (wasRunning) {
|
||||
|
||||
Reference in new issue
Block a user