wip: STCP TCP chat integration — diagnostics, invite TCP fallback, test infra

This commit is contained in:
evgeny committed 2026-08-06 18:41:41 +03:00
1 parent e2d8f68c9a
commit dfe9d36783
41 files changed
+2432 -294

No files matched your search

+16
View File
@@ -16,6 +16,7 @@
#include "chat/db_sync.h"
#include "chat/chat_core.h"
#include "chat/chat_sync.h"
#include "chat/chat_headless_control.h"
#include "stcp_server.h"
#include "control_server.h"
#include "transport_layer/node_conn_direct.h"
@@ -472,6 +473,7 @@ void utun_instance_destroy(struct UTUN_INSTANCE *instance) {
DEBUG_INFO(DEBUG_CATEGORY_SYS, "[DESTROY] G done — ETCP sockets");
/* Phase H: chat */
chat_headless_control_destroy();
chat_sync_destroy(instance);
chat_core_destroy(instance);
DEBUG_INFO(DEBUG_CATEGORY_SYS, "[DESTROY] H done — chat");
@@ -710,6 +712,20 @@ int utun_instance_init(struct UTUN_INSTANCE *instance) {
}
}
// Initialize headless chat control if configured in [chatserver]
if (instance->config->global.headless_control_bind[0] != '\0') {
char ip_str[64] = "127.0.0.1"; int port = 9999;
const char* colon = strrchr(instance->config->global.headless_control_bind, ':');
if (colon) {
size_t ip_len = (size_t)(colon - instance->config->global.headless_control_bind);
if (ip_len < sizeof(ip_str)) { memcpy(ip_str, instance->config->global.headless_control_bind, ip_len); ip_str[ip_len] = '\0'; }
port = atoi(colon + 1);
if (port <= 0 || port > 65535) port = 9999;
}
if (chat_headless_control_init(instance->ua, instance, ip_str, port) != 0)
DEBUG_WARN(DEBUG_CATEGORY_GENERAL, "Failed to init headless chat control (non-fatal)");
}
// Start the main loop
instance->running = 1;