android: fix QR join flow + cleanup log levels + remove log artifacts

- MainActivity: call NativeLib.joinChannel directly (bypass ViewModel null repo)
- LogManager: add Log.d for Kotlin logs visibility in logcat
- ChatViewModel/NativeLib: add diagnostic logs for join path
- chat_sync: JNI-safe logs via __android_log_print, add error on !g_cs
- etcp_debug: DUMP INFO→DEBUG (remove 99.8% packet spam)
- secure_channel/etcp_connections/topo_node: keepalive PING/PONG spam INFO→DEBUG
- .gitignore: logreceiver output + build artifacts
- Remove tracked log files and build dir from repo
This commit is contained in:
evgeny committed 2026-07-28 18:11:11 +03:00
1 parent 0216b0bf50
commit 03b34e9580
40 files changed
+42 -3954

No files matched your search

+24 -4
View File
@@ -23,6 +23,9 @@
#include <string.h>
#include <sqlite3.h>
#include <openssl/evp.h>
#ifdef __ANDROID__
#include <android/log.h>
#endif
static struct chat_sync* g_cs = NULL;
@@ -579,6 +582,9 @@ static void cm_invite_trampoline(void* arg) {
uint64_t node_id = inv->node_id;
uint64_t channel_id = inv->channel_id;
DEBUG_INFO(DEBUG_CATEGORY_DB_SYNC, "%s: invite start ch=%llu node=0x%016llx addrs=%d",
CS_ID, channel_id, node_id, inv->addr_count);
/* save pubkey to nodes */
sqlite3_stmt* st = NULL;
sqlite3_prepare_v2(db, "INSERT INTO nodes(node_id,x25519_pubkey,created_at) VALUES(?,?,?)"
@@ -637,8 +643,13 @@ static void cm_invite_trampoline(void* arg) {
if (inst->topo_groups && ni->v4_addrs) {
struct TOPO_GROUP* g = topo_groups_find(inst->topo_groups, channel_id);
if (g && g->conn_mgr)
if (g && g->conn_mgr) {
conn_mgr_connect_from_invite(g->conn_mgr, ni, channel_id, 0, NULL, NULL);
DEBUG_INFO(DEBUG_CATEGORY_DB_SYNC, "%s: invite connect posted node=0x%016llx", CS_ID, (unsigned long long)node_id);
}
} else {
DEBUG_ERROR(DEBUG_CATEGORY_DB_SYNC, "%s: invite no addrs topo=%p v4=%p", CS_ID,
(void*)inst->topo_groups, (void*)ni->v4_addrs);
}
if (g_cs && g_cs->pending_invite_ch_id != 0 && !g_cs->info_req_timer) {
@@ -660,6 +671,12 @@ void chat_sync_connect_from_invite(uint64_t channel_id, uint64_t node_id,
const uint8_t* addrs_data, int addr_count) {
if (!g_cs || !g_cs->inst || !g_cs->inst->ua) {
int r = -7;
#ifdef __ANDROID__
__android_log_print(ANDROID_LOG_ERROR, "utun-chat", "invite ch=%llu node=%016llx REJECTED g_cs=%p inst=%p ua=%p",
(long long)channel_id, (long long)node_id, (void*)g_cs,
g_cs ? (void*)g_cs->inst : NULL,
(g_cs && g_cs->inst) ? (void*)g_cs->inst->ua : NULL);
#endif
uint8_t err[12]; memcpy(err, &node_id, 8); memcpy(err + 8, &r, 4);
chat_event_post(CHAT_EVT_CONNECT_RESULT, err, 12);
return;
@@ -680,11 +697,14 @@ void chat_sync_connect_from_invite(uint64_t channel_id, uint64_t node_id,
g_cs->pending_invite_ch_id = channel_id;
g_cs->pending_invite_node_id = node_id;
DEBUG_TRACE(DEBUG_CATEGORY_DB_SYNC, "%s: invite ch=%llu node=%016llx pubkey=%016llx addrs=%d",
CS_ID, channel_id, node_id, *(const uint64_t*)pubkey_bin, addr_count);
#ifdef __ANDROID__
__android_log_print(ANDROID_LOG_INFO, "utun-chat", "invite ch=%llu node=%016llx addrs=%d",
(long long)channel_id, (long long)node_id, addr_count);
#endif
#ifndef __ANDROID__
DEBUG_INFO(DEBUG_CATEGORY_DB_SYNC, "%s: invite start ch=%llu node=0x%016llx pubkey=%016llx... addrs=%d",
CS_ID, channel_id, node_id, *(const uint64_t*)pubkey_bin, addr_count);
#endif
struct cm_invite_wrap { struct chat_invite inv; }* w = u_malloc(sizeof(struct cm_invite_wrap));
w->inv = *inv; u_free(inv);
+1 -1
View File
@@ -363,7 +363,7 @@ void topo_node_ping_update_rtt(struct TOPO_GROUPS* groups, uint64_t node_id, uin
nq->connectivity.nat_min_rtt = rtt;
if (nq->connectivity.real_min_rtt == 0 || rtt < nq->connectivity.real_min_rtt)
nq->connectivity.real_min_rtt = rtt;
DEBUG_INFO(DEBUG_CATEGORY_BGP, "ping_update_rtt: node=%016llx rtt=%u (%llu) group=%016llx",
DEBUG_DEBUG(DEBUG_CATEGORY_BGP, "ping_update_rtt: node=%016llx rtt=%u (%llu) group=%016llx",
(unsigned long long)node_id, (unsigned)rtt, (unsigned long long)now, (unsigned long long)g->group_id);
if (groups->instance && groups->instance->topo_sqlite_db)
topo_node_sqlite_update_rtt(groups->instance->topo_sqlite_db, node_id, rtt);
+3 -3
View File
@@ -1657,7 +1657,7 @@ void etcp_connections_read_callback_socket(socket_t sock, void* arg) {
errorcode=2;
goto ec_fr;
}
DEBUG_INFO(DEBUG_CATEGORY_CRYPTO, "X25519 decrypt OK from %s", sockaddr_storage_to_str(&addr).str);
DEBUG_DEBUG(DEBUG_CATEGORY_CRYPTO, "X25519 decrypt OK from %s", sockaddr_storage_to_str(&addr).str);
DEBUG_DEBUG(DEBUG_CATEGORY_CRYPTO, "INIT_DECRYPT_TRY: seskey=%02x%02x%02x%02x recv_len=%zd strip40=%zd salt=%02x%02x%02x%02x%02x%02x%02x%02x enc_pub=%02x%02x%02x%02x",
sc.session_key[0], sc.session_key[1], sc.session_key[2], sc.session_key[3],
recv_len, recv_len - SC_PUBKEY_ENC_SIZE,
@@ -1686,14 +1686,14 @@ void etcp_connections_read_callback_socket(socket_t sock, void* arg) {
uint8_t code = pkt->data[0];
uint64_t peer_id = be64toh(*(uint64_t*)(pkt->data + 2));
if (code == ETCP_PING) {
DEBUG_INFO(DEBUG_CATEGORY_CONNECTION, "X25519 decrypted: PING from peer=0x%016llx src=%s",
DEBUG_DEBUG(DEBUG_CATEGORY_CONNECTION, "X25519 decrypted: PING from peer=0x%016llx src=%s",
(unsigned long long)peer_id, sockaddr_storage_to_str(&addr).str);
int ret = handle_ping(e_sock, pkt, &addr, decrypted_pubkey, pkt_len);
if (ret) { errorcode = ret; goto ec_fr; }
return;
}
if (code == ETCP_PONG) {
DEBUG_INFO(DEBUG_CATEGORY_CONNECTION, "X25519 decrypted: PONG from peer=0x%016llx src=%s",
DEBUG_DEBUG(DEBUG_CATEGORY_CONNECTION, "X25519 decrypted: PONG from peer=0x%016llx src=%s",
(unsigned long long)peer_id, sockaddr_storage_to_str(&addr).str);
int ret = handle_pong(e_sock, pkt, &addr, pkt_len);
if (ret) { errorcode = ret; goto ec_fr; }
+1 -1
View File
@@ -75,5 +75,5 @@ void etcp_dump_pkt_sections(struct ETCP_DGRAM* pkt, struct ETCP_LINK* link, int
}
}
DEBUG_INFO(DEBUG_CATEGORY_DUMP, "%s", buf);
DEBUG_DEBUG(DEBUG_CATEGORY_DUMP, "%s", buf);
}
+1 -1
View File
@@ -238,7 +238,7 @@ sc_status_t sc_set_peer_public_key(sc_context_t *ctx, const uint8_t *peer_public
EVP_PKEY_CTX_free(derive_ctx);
EVP_PKEY_free(my_pkey);
EVP_PKEY_free(peer_pkey);
DEBUG_INFO(DEBUG_CATEGORY_CRYPTO, "X25519 key exchange complete");
DEBUG_DEBUG(DEBUG_CATEGORY_CRYPTO, "X25519 key exchange complete");
return SC_OK;
}