fix(chat): reject inconsistent repeated core initialization

This commit is contained in:
evgeny committed 2026-10-27 11:48:09 +01:00
1 parent 0442a42856
commit 68ce0e3d71
1 file changed
+2 -2
+2 -2
View File
@@ -87,8 +87,8 @@ int chat_core_init(struct UTUN_INSTANCE* inst, const char* db_path) {
}
if (inst->chat_core) {
if (inst->chat_core->initialized) return 0;
DEBUG_ERROR(DEBUG_CATEGORY_CHAT_SYNC, "chat init: incomplete context already exists"); return -1;
if (inst->chat_core->initialized && inst->chat_core->db == inst->topo_sqlite_db && !strcmp(inst->chat_core->db_path, db_path)) return 0;
DEBUG_ERROR(DEBUG_CATEGORY_CHAT_SYNC, "chat init: incomplete context or different DB/path already exists"); return -1;
}
struct chat_core_ctx* cc = u_calloc(1, sizeof(*cc));
if (!cc) { DEBUG_ERROR(DEBUG_CATEGORY_CHAT_SYNC, "%s: OOM for chat_core_ctx", CC_ID); return -1; }