connection: логировать только connect/reconnect/disconnect; фиксы конфига чатгуи
- категория connection теперь только жизненный цикл соединения; INIT/PING/keepalive переклассифицированы в ETCP/SOCKET/KEEPALIVE/REALITY/ROUTING, удалены дубли - settingsdialog: устранён дубль my_node_name в конфиге (двухпроходная запись + только при изменении) - storagesettingspage: канонические ключи storage_total_size/storage_unit_size с суффиксом M/G - audiodevicesettingspage: compressor_max_gain_db min 0→1 - etcp_connections: %s-баг в логе TCP link (addr → sockaddr_storage_to_str) - docs/sample: [chatserver], актуализированы ключи хранилища
This commit is contained in:
1 parent
b7669eea36
commit
b7da6547c1
12 files changed
+185
-173
No files matched your search
+1
-1
@@ -41,7 +41,7 @@ typedef int debug_category_t;
|
||||
#define DEBUG_CATEGORY_NONE 0
|
||||
#define DEBUG_CATEGORY_SYS 1 // System: u_async, ll_queue, memory, timing
|
||||
// #define DEBUG_CATEGORY_LL_QUEUE 2 (merged into SYS)
|
||||
#define DEBUG_CATEGORY_CONNECTION 3 // Connection: links, keepalive, status events
|
||||
#define DEBUG_CATEGORY_CONNECTION 3 // Connection: connect/reconnect/disconnect events only
|
||||
#define DEBUG_CATEGORY_ETCP 4 // ETCP: protocol, BBR, normalizer
|
||||
#define DEBUG_CATEGORY_CRYPTO 5 // crypto operations
|
||||
// #define DEBUG_CATEGORY_MEMORY 6 (merged into SYS)
|
||||
|
||||
+7
-7
@@ -23,24 +23,24 @@ int get_outgoing_local_ip(const struct sockaddr_storage *local_addr,
|
||||
struct sockaddr_storage *result)
|
||||
{
|
||||
if (!local_addr || !remote_addr || !result) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CONNECTION, "get_outgoing_local_ip: NULL argument");
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_SOCKET, "get_outgoing_local_ip: NULL argument");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int family = local_addr->ss_family;
|
||||
if (family != AF_INET && family != AF_INET6) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CONNECTION, "get_outgoing_local_ip: unsupported family %d", family);
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_SOCKET, "get_outgoing_local_ip: unsupported family %d", family);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (remote_addr->ss_family != family) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CONNECTION, "get_outgoing_local_ip: family mismatch");
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_SOCKET, "get_outgoing_local_ip: family mismatch");
|
||||
return -1;
|
||||
}
|
||||
|
||||
socket_t sock = socket_create_udp(family);
|
||||
if (sock == SOCKET_INVALID) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CONNECTION, "get_outgoing_local_ip: socket_create_udp failed");
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_SOCKET, "get_outgoing_local_ip: socket_create_udp failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ int get_outgoing_local_ip(const struct sockaddr_storage *local_addr,
|
||||
socklen_t bind_len = (family == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6);
|
||||
if (bind(sock, (struct sockaddr *)&bind_addr, bind_len) != 0) {
|
||||
int err = socket_get_error();
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CONNECTION, "get_outgoing_local_ip: bind failed: %s", socket_strerror(err));
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_SOCKET, "get_outgoing_local_ip: bind failed: %s", socket_strerror(err));
|
||||
socket_close_wrapper(sock);
|
||||
return -1;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ int get_outgoing_local_ip(const struct sockaddr_storage *local_addr,
|
||||
socklen_t remote_len = (family == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6);
|
||||
if (connect(sock, (struct sockaddr *)remote_addr, remote_len) != 0) {
|
||||
int err = socket_get_error();
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CONNECTION, "get_outgoing_local_ip: connect failed: %s", socket_strerror(err));
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_SOCKET, "get_outgoing_local_ip: connect failed: %s", socket_strerror(err));
|
||||
socket_close_wrapper(sock);
|
||||
return -1;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ int get_outgoing_local_ip(const struct sockaddr_storage *local_addr,
|
||||
socklen_t local_len = sizeof(local);
|
||||
if (getsockname(sock, (struct sockaddr *)&local, &local_len) != 0) {
|
||||
int err = socket_get_error();
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CONNECTION, "get_outgoing_local_ip: getsockname failed: %s", socket_strerror(err));
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_SOCKET, "get_outgoing_local_ip: getsockname failed: %s", socket_strerror(err));
|
||||
socket_close_wrapper(sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user