Убрал спам-логи ETCP SEND/RECV/DECRYPT OK + добавил диагностику синхронизации мемберов (DEBUG_CATEGORY_DEBUG) в ключевые точки topo_group, merkle_sync, member_sync, chat_sync
This commit is contained in:
1 parent
e708940bcd
commit
895eb0abbf
5 files changed
+24
-17
No files matched your search
@@ -971,9 +971,6 @@ int etcp_encrypt_send(struct ETCP_DGRAM* dgram) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CONNECTION, "sendto failed, sock_err=%d dst=%s fd=%d",
|
||||
socket_get_error(), sockaddr_storage_to_str(addr).str, dgram->link->conn->fd);
|
||||
dgram->link->send_errors++; errcode=4; goto es_err;
|
||||
} else {
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_DEBUG, "ETCP SEND %zd bytes to %s fd=%d ne_len=%d", sent,
|
||||
sockaddr_storage_to_str(addr).str, dgram->link->conn->fd, dgram->noencrypt_len);
|
||||
}
|
||||
return (int)sent;
|
||||
es_err:
|
||||
@@ -1542,10 +1539,7 @@ void etcp_connections_read_callback_socket(socket_t sock, void* arg) {
|
||||
int errorcode=0;
|
||||
|
||||
struct ETCP_LINK* link=etcp_link_find_by_addr(e_sock, &addr);
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_DEBUG, "RECV %zd bytes from %s link=%p session_ready=%d",
|
||||
recv_len, sockaddr_storage_to_str(&addr).str, link,
|
||||
link && link->etcp ? link->etcp->crypto_ctx.session_ready : -1);
|
||||
|
||||
|
||||
// Try normal decryption first if we have an established link with session keys
|
||||
// This is the common case for data packets and responses
|
||||
// if (link) {
|
||||
@@ -1555,7 +1549,6 @@ void etcp_connections_read_callback_socket(socket_t sock, void* arg) {
|
||||
if (link!=NULL && link->etcp!=NULL && link->etcp->crypto_ctx.session_ready) {
|
||||
sc_status_t dec_rc = sc_decrypt(&link->etcp->crypto_ctx, data, recv_len, (uint8_t*)&pkt->timestamp, &pkt_len);
|
||||
if (!dec_rc) {
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_DEBUG, "DECRYPT OK link=%p log=%s", link, link->etcp->log_name);
|
||||
goto process_decrypted;
|
||||
}
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "etcp: DECRYPT FAIL rc=%d link=%p log=%s session_ready=%d my_pub=%016llx peer_pub=%016llx", dec_rc, link, link->etcp->log_name, link->etcp->crypto_ctx.session_ready, *(uint64_t*)link->etcp->crypto_ctx.pk->public_key, *(uint64_t*)link->etcp->crypto_ctx.peer_public_key);
|
||||
|
||||
+8
-2
@@ -364,7 +364,9 @@ void topo_group_new_conn(struct TOPO_GROUP* group, struct ETCP_CONN* conn) {
|
||||
|
||||
struct TOPO_NODEQ* peer_nq = topo_node_find_by_id(group, conn->peer_node_id);
|
||||
topo_group_add_to_senders(group, conn);
|
||||
if (peer_nq && peer_nq->alien) { DEBUG_INFO(DEBUG_CATEGORY_BGP, "peer 0x%016llx is alien, skipping route exchange", (unsigned long long)conn->peer_node_id); return; }
|
||||
if (peer_nq && peer_nq->alien) { DEBUG_INFO(DEBUG_CATEGORY_BGP, "peer 0x%016llx is alien, skipping route exchange", (unsigned long long)conn->peer_node_id); DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "topo_group_new_conn: peer=%016llx group=%016llx type=%d ch=%s ALIEN=1 — SKIP", (unsigned long long)conn->peer_node_id, (unsigned long long)group->group_id, group->group_type, group->channel_id); return; }
|
||||
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "topo_group_new_conn: peer=%016llx group=%016llx type=%d ch=%s alien=%d", (unsigned long long)conn->peer_node_id, (unsigned long long)group->group_id, group->group_type, group->channel_id, peer_nq ? peer_nq->alien : -1);
|
||||
|
||||
struct ll_entry* entry = conn->instance->connections->head;
|
||||
while (entry) { struct conn_queue_entry* ce = (struct conn_queue_entry*)entry->data; struct ETCP_LINK* l = ce->conn->links; while (l) { if (l->initialized && l->conn && l->nat_check_status < NAT_CHECK_IN_PROGRESS) topo_group_start_link_nat_check(group, l); l = l->next; } entry = entry->next; }
|
||||
@@ -558,6 +560,7 @@ int topo_group_process_nodeinfo(struct TOPO_GROUP* group, struct ETCP_CONN* from
|
||||
uint8_t new_ver = ni->ver;
|
||||
|
||||
if (nodeinfo1 && (int8_t)(nodeinfo1->last_ver - new_ver) >= 0) {
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "NODEINFO skip (stale ver): node=%016llx cur_ver=%d new_ver=%d from=%s", (unsigned long long)node_id, nodeinfo1->last_ver, new_ver, from->log_name);
|
||||
int new_hops = ni->hop_count + 1;
|
||||
if (new_hops <= MAX_HOPS) {
|
||||
uint64_t hop_list[MAX_HOPS];
|
||||
@@ -639,12 +642,15 @@ int topo_group_process_nodeinfo(struct TOPO_GROUP* group, struct ETCP_CONN* from
|
||||
sqlite3* sdb = group->instance->topo_groups->topo_sqlite_db;
|
||||
if (sdb) {
|
||||
topo_node_sqlite_node_put(sdb, nodeinfo1);
|
||||
if (group->group_type == TOPO_GROUP_TYPE_CHAT && group->channel_id[0])
|
||||
if (group->group_type == TOPO_GROUP_TYPE_CHAT && group->channel_id[0]) {
|
||||
topo_node_sqlite_member_put(sdb, group->channel_id, node_id, NULL, NULL);
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "SQLite member_put: ch=%s node=%016llx", group->channel_id, (unsigned long long)node_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (group->instance->control_srv) control_server_notify_node_change(group->instance->control_srv, nodeinfo1);
|
||||
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "node_updated_cb: node=%016llx has_cb=%d ch=%s type=%d", (unsigned long long)node_id, group->instance->topo_groups->node_updated_cb ? 1 : 0, group->channel_id, group->group_type);
|
||||
if (group->instance->topo_groups->node_updated_cb)
|
||||
group->instance->topo_groups->node_updated_cb(group->instance, node_id, ni->public_key, ni->ed25519_public_key);
|
||||
|
||||
|
||||
Reference in new issue
Block a user