debug: add diagnostic logging for ETCP recv/INIT/dispatch paths
- etcp_connections.c: raw_recv log, INIT conn lookup details, insert_link DUP details - etcp_api.c: dispatch id/cb logs with DROPPED warning when no handler - chat_sync.c: etcp_send rc log, fix ac_result_cb to always clear ca_state
This commit is contained in:
1 parent
a65478edcc
commit
7c2798ec0e
3 files changed
+21
-6
No files matched your search
+5
-3
@@ -102,10 +102,12 @@ void etcp_int_recv(struct ll_queue* queue, void* arg) {
|
||||
uint8_t id = e->dgram[0];
|
||||
struct UTUN_INSTANCE* inst = conn->instance;
|
||||
if (!inst) { queue_dgram_free(e); queue_entry_free(e); queue_resume_callback(queue); return; }
|
||||
if (inst->api_bindings.callbacks[id])
|
||||
if (inst->api_bindings.callbacks[id]) {
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "dispatch id=0x%02x conn=%s len=%zu", id, conn->log_name, e->len);
|
||||
inst->api_bindings.callbacks[id](conn, e);
|
||||
else if (inst->api_bindings.callbacks[0])
|
||||
} else if (inst->api_bindings.callbacks[0]) {
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "dispatch id=0x%02x (fallback) conn=%s len=%zu", id, conn->log_name, e->len);
|
||||
inst->api_bindings.callbacks[0](conn, e);
|
||||
else { queue_dgram_free(e); queue_entry_free(e); }
|
||||
} else { DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "dispatch id=0x%02x NO CB conn=%s len=%zu — DROPPED", id, conn->log_name, e->len); queue_dgram_free(e); queue_entry_free(e); }
|
||||
queue_resume_callback(queue);
|
||||
}
|
||||
+12
-1
@@ -398,7 +398,14 @@ static int insert_link(struct ETCP_SOCKET* e_sock, struct ETCP_LINK* link) {
|
||||
}
|
||||
|
||||
int idx = find_link_index(e_sock, link->ip_port_hash);
|
||||
if (idx >= 0) return -1;
|
||||
if (idx >= 0) {
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "insert_link DUP: hash=0x%08x idx=%d existing_conn=%s existing_etcp=%s num_channels=%zu sock=%s",
|
||||
link->ip_port_hash, idx,
|
||||
e_sock->links[idx]->etcp ? e_sock->links[idx]->etcp->log_name : "?",
|
||||
e_sock->links[idx]->etcp ? "[...]" : "?",
|
||||
e_sock->num_channels, e_sock->name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
idx = -(idx + 1);
|
||||
|
||||
@@ -1525,6 +1532,8 @@ void etcp_connections_read_callback_socket(socket_t sock, void* arg) {
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "raw_recv on %s from=%s len=%zd", e_sock->name, sockaddr_storage_to_str(&addr).str, recv_len);
|
||||
|
||||
// DUMP: Show received packet content
|
||||
if (debug_should_output(DEBUG_LEVEL_DEBUG, DEBUG_CATEGORY_CRYPTO)) log_dump(DEBUG_LEVEL_DEBUG, DEBUG_CATEGORY_CRYPTO, "RECV in:", data, recv_len);
|
||||
|
||||
@@ -1705,6 +1714,8 @@ void etcp_connections_read_callback_socket(socket_t sock, void* arg) {
|
||||
if (memcmp(conn->crypto_ctx.peer_public_key, sc.peer_public_key, SC_PUBKEY_SIZE)) { errorcode=5; DEBUG_ERROR(DEBUG_CATEGORY_CRYPTO, "peer key mismatch for node %016llx", (unsigned long long)peer_id); goto ec_fr; }// коллизия - peer id совпал а ключи разные.
|
||||
}
|
||||
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "INIT conn=%s new_conn=%d peer=0x%016llx state=%d links_up=%d links=%p", conn->log_name, new_conn, (unsigned long long)peer_id, conn->state, conn->links_up, (void*)conn->links);
|
||||
|
||||
// Check if link already exists (for CHANNEL_INIT recovery)
|
||||
|
||||
struct ETCP_LINK* existing_link = etcp_link_find_by_remote_id(conn, req->link_id);
|
||||
|
||||
Reference in new issue
Block a user