Убрал спам-логи 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
@@ -494,6 +494,8 @@ static void cs_on_conn_up(struct ETCP_CONN* conn, void* arg) {
|
||||
if (peer == 0 || peer == g_cs->inst->node_id) return;
|
||||
if (!conn->initialized) { DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "%s: conn_up SKIP — not initialized peer=%016llx", CS_ID, (unsigned long long)peer); return; }
|
||||
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "%s: conn_up peer=%016llx pending_invite=%llu links_up=%d", CS_ID, (unsigned long long)peer, (unsigned long long)g_cs->pending_invite_ch_id, conn->links_up);
|
||||
|
||||
if (g_cs->pending_invite_ch_id != 0 && !g_cs->info_req_timer) {
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CONNECTIVITY, "%s: conn_up invite path peer=%016llx ch=%llu",
|
||||
CS_ID, (unsigned long long)peer, (unsigned long long)g_cs->pending_invite_ch_id);
|
||||
|
||||
@@ -228,6 +228,7 @@ static void _on_node_updated(struct UTUN_INSTANCE* inst, uint64_t node_id,
|
||||
(void)x25519; (void)ed25519;
|
||||
if (!inst) return;
|
||||
sqlite3* db = _db(inst); if (!db) return;
|
||||
int rc = 0;
|
||||
sqlite3_stmt* cs = NULL;
|
||||
if (sqlite3_prepare_v2(db, "SELECT channel_id FROM channels", -1, &cs, NULL) != SQLITE_OK) return;
|
||||
while (sqlite3_step(cs) == SQLITE_ROW) {
|
||||
@@ -238,12 +239,15 @@ static void _on_node_updated(struct UTUN_INSTANCE* inst, uint64_t node_id,
|
||||
sqlite3_stmt* ps = NULL;
|
||||
if (sqlite3_prepare_v2(db, buf, -1, &ps, NULL) == SQLITE_OK) {
|
||||
sqlite3_bind_int64(ps, 1, (sqlite3_int64)node_id);
|
||||
if (sqlite3_step(ps) == SQLITE_ROW)
|
||||
if (sqlite3_step(ps) == SQLITE_ROW) {
|
||||
merkle_sync_recompute_path(inst, ch, node_id);
|
||||
rc++;
|
||||
}
|
||||
sqlite3_finalize(ps);
|
||||
}
|
||||
}
|
||||
sqlite3_finalize(cs);
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "%s: _on_node_updated node=%016llx channels_recomputed=%d", MS_ID, (unsigned long long)node_id, rc);
|
||||
}
|
||||
|
||||
/* ── Public API ── */
|
||||
@@ -253,7 +257,7 @@ int member_sync_init(struct UTUN_INSTANCE* inst) {
|
||||
int rc = merkle_sync_init(inst, 0x31, &g_member_ops, inst);
|
||||
if (rc != 0) return rc;
|
||||
topo_groups_set_node_updated_cb(inst->topo_groups, _on_node_updated);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CONNECTIVITY, "%s: initialized", MS_ID);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CONNECTIVITY, "%s: initialized, merkle_rc=%d cb_registered=%d", MS_ID, rc, inst->topo_groups && inst->topo_groups->node_updated_cb ? 1 : 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -174,12 +174,12 @@ static int _get_level_hashes(struct merkle_sync* ms, const char* ns,
|
||||
/* ── Send helpers ── */
|
||||
|
||||
static struct ETCP_CONN* ms_find_conn_for_node(struct UTUN_INSTANCE* inst, uint64_t node_id) {
|
||||
if (!inst->connections) return NULL;
|
||||
if (!inst->connections) { DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "%s: find_conn — inst->connections is NULL", MS_ID); return NULL; }
|
||||
struct ll_entry* e = queue_find_data_by_index(inst->connections, (const uint8_t*)&node_id);
|
||||
if (e) {
|
||||
struct conn_queue_entry* ce = (struct conn_queue_entry*)e->data;
|
||||
if (ce->conn->initialized && ce->conn->links_up) return ce->conn;
|
||||
}
|
||||
if (!e) { DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "%s: find_conn — node=%016llx NOT FOUND in connections", MS_ID, (unsigned long long)node_id); return NULL; }
|
||||
struct conn_queue_entry* ce = (struct conn_queue_entry*)e->data;
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "%s: find_conn — node=%016llx found=%d initialized=%d links_up=%d", MS_ID, (unsigned long long)node_id, 1, ce->conn->initialized, ce->conn->links_up);
|
||||
if (ce->conn->initialized && ce->conn->links_up) return ce->conn;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -197,6 +197,7 @@ static int _send_msg(struct merkle_sync* ms, uint64_t peer,
|
||||
if (!conn) { DEBUG_ERROR(DEBUG_CATEGORY_CONNECTIVITY, "%s: no conn for node %016llx", MS_ID, (unsigned long long)peer); u_free(buf); queue_entry_free(entry); return -1; }
|
||||
int r = etcp_send(conn, entry);
|
||||
if (r != 0) { u_free(buf); queue_entry_free(entry); }
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "%s: send OK peer=%016llx len=%zu rc=%d", MS_ID, (unsigned long long)peer, len, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -601,6 +602,7 @@ int merkle_sync_start(struct UTUN_INSTANCE* inst, uint64_t peer,
|
||||
_ensure_table(ms);
|
||||
|
||||
struct ms_session* s = _session_find(ms, peer, ns);
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "%s: start peer=%016llx ns=%s new=%d initialized=%d", MS_ID, (unsigned long long)peer, ns, s ? 0 : 1, ms->initialized);
|
||||
if (!s) {
|
||||
s = u_calloc(1, sizeof(*s));
|
||||
if (!s) return -1;
|
||||
|
||||
Reference in new issue
Block a user