diff --git a/src/chat/chat_core.c b/src/chat/chat_core.c index 82ad23a8f..8317df7ee 100644 --- a/src/chat/chat_core.c +++ b/src/chat/chat_core.c @@ -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; }