перенос chat-логики из chatgui/transport в src/chat/
- Создан src/chat/ с chat_event.h/c — система нотификаций - Перенесены chat_core, chat_msg, chat_channel, chat_profile, chat_status - Перенесены chat_sync, member_sync, merkle_sync, db_sync - gui_bridge_post() заменён на chat_event_post() с возможностью регистрации обработчика - chat_event_set_handler() — chatgui регистрирует мост в gui_bridge - Без обработчика: события логируются через DEBUG_DEBUG + log_dump - chat интегрирован в utun_instance.c (при db_path в конфиге) - Обновлены include-пути, Makefile.am, CMakeLists.txt - Из chatgui удалены старые transport/ файлы, обновлён utun_node.cpp
This commit is contained in:
1 parent
4595052b5b
commit
ed6132fcda
25 files changed
+262
-165
No files matched your search
+15
-1
@@ -13,7 +13,9 @@
|
||||
#include "etcp_connections.h"
|
||||
#include "etcp.h"
|
||||
#include "conn_mgr.h"
|
||||
#include "db_sync.h"
|
||||
#include "chat/db_sync.h"
|
||||
#include "chat/chat_core.h"
|
||||
#include "chat/chat_sync.h"
|
||||
#include "stcp_server.h"
|
||||
#include "control_server.h"
|
||||
|
||||
@@ -418,6 +420,10 @@ void utun_instance_destroy(struct UTUN_INSTANCE *instance) {
|
||||
instance->etcp_sockets = NULL;
|
||||
DEBUG_INFO(DEBUG_CATEGORY_MEMORY, "[INSTANCE_DESTROY] ETCP sockets cleanup complete");
|
||||
|
||||
// Cleanup chat before db_sync (chat releases db_sync instances)
|
||||
chat_sync_destroy(instance);
|
||||
chat_core_destroy(instance);
|
||||
|
||||
// Cleanup db_sync before connections cleanup (db_sync_destroy iterates connections)
|
||||
db_sync_destroy(instance);
|
||||
|
||||
@@ -583,6 +589,14 @@ int utun_instance_init(struct UTUN_INSTANCE *instance) {
|
||||
// db_sync — распределённая таблица с репликацией
|
||||
db_sync_init(instance);
|
||||
|
||||
// chat — сообщения, каналы, P2P-синхронизация
|
||||
if (instance->config->global.db_path[0] && instance->config->global.db_sync_enabled) {
|
||||
char db_file[512];
|
||||
snprintf(db_file, sizeof(db_file), "%s/chats.db", instance->config->global.db_path);
|
||||
if (chat_core_init(instance, db_file) == 0)
|
||||
chat_sync_init(instance);
|
||||
}
|
||||
|
||||
// Set TUN interface in routing module
|
||||
if (instance->tun) {
|
||||
routing_set_tun(instance);
|
||||
|
||||
Reference in new issue
Block a user