diff --git a/src/chat/chat_channel.c b/src/chat/chat_channel.c index e2c295b6..ef680e5a 100644 --- a/src/chat/chat_channel.c +++ b/src/chat/chat_channel.c @@ -283,7 +283,7 @@ void chat_core_connect_channel(const char* ch_id) { if (!group) { DEBUG_ERROR(DEBUG_CATEGORY_CHAT_SYNC, "%s: connect_channel — group not found ch=%s gid=%016llx total_groups=%d", CC_ID, ch_id, (unsigned long long)gid, queue_entry_count(g_cc.inst->topo_groups->group_list)); return; } if (group->connect) { - DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "%s: connect_channel — already in progress ch=%s active=%d", + DEBUG_DEBUG(DEBUG_CATEGORY_CHAT_SYNC, "%s: connect_channel — already in progress ch=%s active=%d", CC_ID, ch_id, topo_group_connect_active_count(group)); return; } diff --git a/src/chat/db_sync.c b/src/chat/db_sync.c index b98d3905..71cea6a9 100644 --- a/src/chat/db_sync.c +++ b/src/chat/db_sync.c @@ -460,7 +460,7 @@ static void db_recalc_tick(void* arg) if (si->recalc.pos >= total) { si->recalc.timer = NULL; - DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "recalc complete tbl=%s pos=%u(total)", SI_TBL(si), si->recalc.pos); + DEBUG_DEBUG(DEBUG_CATEGORY_CHAT_SYNC, "recalc complete tbl=%s pos=%u(total)", SI_TBL(si), si->recalc.pos); } else { si->recalc.timer = uasync_set_timeout(si->db_sync->inst->ua, 100, si, db_recalc_tick, "db_recalc"); } @@ -675,14 +675,14 @@ static int db_sync_send_hash(struct DB_SYNC* db, uint64_t node_id, uint64_t hash struct ETCP_CONN* conn = instance_find_conn(db->inst, node_id); if (!conn || !conn->links_up) { - DEBUG_WARN(DEBUG_CATEGORY_CHAT_SYNC, "sync: send DROP — no direct conn to %04llX (hash=%016llx, type=%02x, conn=%p lu=%d)", + DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "sync: send DROP — no conn to %04llX (hash=%016llx, type=%02x)", (unsigned long long)(node_id >> 16), hash, plen > 0 ? payload[0] : 0, (void*)conn, conn ? conn->links_up : -1); queue_entry_free(entry); return -1; } int ret = etcp_send(conn, entry); - DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "sync: send OK → etcp_send ret=%d conn=%s l_up=%d init=%d q=%p", + DEBUG_DEBUG(DEBUG_CATEGORY_CHAT_SYNC, "sync: send OK → etcp_send ret=%d conn=%s l_up=%d init=%d q=%p", ret, conn->log_name, conn->links_up, conn->initialized, (void*)conn->send_input_q); return ret; } @@ -1134,7 +1134,7 @@ static void db_handle_ack_push(struct DB_SYNC_INSTANCE* si, uint64_t src, const int changed = sqlite3_changes(SI_DB(si)); sqlite3_finalize(stmt); if (changed > 0) - DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "sync [%s:%04llX] ← PUSH ACK: ts=%llu — delivery confirmed by peer", + DEBUG_DEBUG(DEBUG_CATEGORY_CHAT_SYNC, "sync [%s:%04llX] ← PUSH ACK: ts=%llu — delivery confirmed by peer", SI_SHRT(si), (unsigned long long)(src >> 16), (unsigned long long)ts); } si_delivery_update(si, ts, author, src); @@ -1166,9 +1166,6 @@ static void db_handle_push(struct DB_SYNC_INSTANCE* si, uint64_t src, const uint memcpy(ack + 1, &rts, 8); memcpy(ack + 9, &rauthor, 8); db_sync_send(si, src, ack, 17); - DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "sync [%s:%04llX] ← PUSH: msg id=%llu author=%016llX ts=%llu → inserted at pos=%u (of %u total)", - SI_SHRT(si), (unsigned long long)(src >> 16), - (unsigned long long)rid, (unsigned long long)rauthor, (unsigned long long)rts, ins_pos, total); DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "sync [%s:%04llX] ← PUSH: msg id=%llu author=%016llX ts=%llu → inserted at pos=%u (of %u total)", SI_SHRT(si), (unsigned long long)(src >> 16), (unsigned long long)rid, (unsigned long long)rauthor, (unsigned long long)rts, ins_pos, total); @@ -1525,7 +1522,7 @@ static void db_sync_peer_check_cb(void* arg) for (int j = 0; j < si->peer_count; j++) { struct SI_PEER* p = &si->peers[j]; if (p->sync_state == 1 && p->sync_start_tb > 0 && now - p->sync_start_tb > to_tb) { - DEBUG_WARN(DEBUG_CATEGORY_CHAT_SYNC, + DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "sync [%s:%04llX] TIMEOUT: no response for %llu ms, sync_state 1→0 (synced_pos was %u)", SI_SHRT(si), (unsigned long long)(p->node_id >> 16), (unsigned long long)((now - p->sync_start_tb) / 10), p->synced_pos); diff --git a/tools/chatgui/db/db_manager.cpp b/tools/chatgui/db/db_manager.cpp index 1790b872..61e480e2 100644 --- a/tools/chatgui/db/db_manager.cpp +++ b/tools/chatgui/db/db_manager.cpp @@ -79,7 +79,7 @@ DbManager::~DbManager() { for (auto it = m_cursors.begin(); it != m_cursors.end(); ++it) sqlite3_finalize(it.value()); m_cursors.clear(); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "DbManager: destroyed"); + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "DbManager: destroyed"); } sqlite3_stmt* DbManager::prepareOrNull(const char* sql) const { diff --git a/tools/chatgui/src/animtimer.cpp b/tools/chatgui/src/animtimer.cpp index 1cca9184..bfdd6760 100644 --- a/tools/chatgui/src/animtimer.cpp +++ b/tools/chatgui/src/animtimer.cpp @@ -16,7 +16,7 @@ AnimTimer *AnimTimer::instance() { void AnimTimer::shutdown() { instance()->m_timer.stop(); instance()->m_icons.clear(); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "AnimTimer: shutdown"); + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "AnimTimer: shutdown"); } void AnimTimer::registerIcon(const QString &key, LottieIcon *icon) { diff --git a/tools/chatgui/src/channellist.cpp b/tools/chatgui/src/channellist.cpp index f152969c..ad1e679a 100644 --- a/tools/chatgui/src/channellist.cpp +++ b/tools/chatgui/src/channellist.cpp @@ -203,9 +203,9 @@ void ChannelList::loadChannels() { item->setData(ch.lastMsgAt, ChannelLastMsgAtRole); item->setData(makeChannelIcon(colors[ci % 6], letter), ChannelIconRole); m_model->appendRow(item); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "ChannelList::loadChannels row=%d cid='%s' name='%s' unread=%d lastMsgAt=%lld sort=%d", + DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "ChannelList::loadChannels row=%d cid='%s' name='%s' unread=%d lastMsgAt=%lld", m_model->rowCount()-1, qPrintable(ch.channelId), qPrintable(ch.name), ch.unreadCount, - (long long)ch.lastMsgAt, sortMode); + (long long)ch.lastMsgAt); ci++; } } @@ -233,18 +233,14 @@ void ChannelList::selectChannel(const QString& channelId) { void ChannelList::setChannelPeersOnline(const QString& channelId, int count) { int found = 0; - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "ChannelList::setChannelPeersOnline search='%s' online=%d rows=%d", - qPrintable(channelId), count, m_model->rowCount()); for (int row = 0; row < m_model->rowCount(); row++) { QStandardItem* item = m_model->item(row); if (item) { QString itemCid = item->data(ChannelChannelIdRole).toString(); int match = (itemCid == channelId) ? 1 : 0; - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, " row=%d cid='%s' match=%d", row, qPrintable(itemCid), match); if (match) { item->setData(count, ChannelPeersOnlineRole); item->setData(m_autoConnectActive ? 1 : 0, ChannelAutoConnectActiveRole); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, " SET online=%d", count); found = 1; break; } diff --git a/tools/chatgui/src/inputbar.cpp b/tools/chatgui/src/inputbar.cpp index f6c405d9..5d05e34f 100644 --- a/tools/chatgui/src/inputbar.cpp +++ b/tools/chatgui/src/inputbar.cpp @@ -234,8 +234,6 @@ void InputBar::onSendClicked() { m_attachPreview->hide(); } if (!text.isEmpty()) { - GUI_INFO("send: len=%d hasLF=%d text='%s'", - text.length(), text.contains('\n'), qPrintable(text)); emit sendMessage(text); m_input->clear(); if (m_emojiPanel) m_emojiPanel->hide(); diff --git a/tools/chatgui/src/main.cpp b/tools/chatgui/src/main.cpp index 49f1e731..e621540e 100644 --- a/tools/chatgui/src/main.cpp +++ b/tools/chatgui/src/main.cpp @@ -40,12 +40,12 @@ static BOOL WINAPI console_ctrl_handler(DWORD dwCtrlType) { static struct ShutdownSentinel { ~ShutdownSentinel() { - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "main: static destructors done"); + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "main: static destructors done"); #ifdef _WIN32 DWORD threads = count_threads(); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "main: threads at exit=%lu", (unsigned long)threads); + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "main: threads at exit=%lu", (unsigned long)threads); if (threads > 4) { - DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "main: %lu hanging threads, TerminateProcess", (unsigned long)threads); + DEBUG_WARN(DEBUG_CATEGORY_GENERAL, "main: %lu hanging threads, TerminateProcess", (unsigned long)threads); fflush(nullptr); TerminateProcess(GetCurrentProcess(), 0); } @@ -128,6 +128,6 @@ int main(int argc, char *argv[]) { #endif int ret = app.exec(); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "main: app.exec() returned %d", ret); + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "main: app.exec() returned %d", ret); return ret; } diff --git a/tools/chatgui/src/mainwindow.cpp b/tools/chatgui/src/mainwindow.cpp index f8ce54cc..4eb7ea09 100644 --- a/tools/chatgui/src/mainwindow.cpp +++ b/tools/chatgui/src/mainwindow.cpp @@ -97,15 +97,15 @@ MainWindow::MainWindow(QWidget *parent, DbManager* db, const QString& cfgPath, MainWindow::~MainWindow() { if (m_recorder) { m_recorder->shutdown(); m_recorder = nullptr; } SoundManager::instance()->shutdown(); - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "MainWindow: ~MainWindow — saving channel state"); + DEBUG_DEBUG(DEBUG_CATEGORY_GENERAL, "MainWindow: ~MainWindow — saving channel state"); if (m_messageList) m_messageList->saveChannelState(); - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "MainWindow: ~MainWindow — stopping utun node"); + DEBUG_DEBUG(DEBUG_CATEGORY_GENERAL, "MainWindow: ~MainWindow — stopping utun node"); if (m_node) { m_node->stop(); delete m_node; m_node = nullptr; } - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "MainWindow: ~MainWindow — node stop+delete done"); + DEBUG_DEBUG(DEBUG_CATEGORY_GENERAL, "MainWindow: ~MainWindow — node stop+delete done"); AnimTimer::shutdown(); MessageList::cleanupAnimations(); - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "MainWindow: ~MainWindow — animations cleaned"); - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "MainWindow: ~MainWindow done"); + DEBUG_DEBUG(DEBUG_CATEGORY_GENERAL, "MainWindow: ~MainWindow — animations cleaned"); + DEBUG_DEBUG(DEBUG_CATEGORY_GENERAL, "MainWindow: ~MainWindow done"); } void MainWindow::setupUi() { @@ -330,7 +330,7 @@ void MainWindow::setupTray() { } void MainWindow::closeEvent(QCloseEvent *event) { - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "MainWindow: closeEvent — hiding to tray"); + DEBUG_DEBUG(DEBUG_CATEGORY_GENERAL, "MainWindow: closeEvent — hiding to tray"); hide(); m_trayIcon->showMessage("Chat", "Application minimized to tray.", QSystemTrayIcon::Information, 2000); @@ -408,8 +408,6 @@ void MainWindow::showSettings() { void MainWindow::onMessageReceived(const char* ch_id, int ch_id_len, uint64_t author) { QString cid = QString::fromUtf8(ch_id, ch_id_len); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "MainWindow::onMessageReceived ch=%s author=%llu cur=%s", - qPrintable(cid), (unsigned long long)author, qPrintable(m_currentChannelId)); if (m_db && author != m_db->myNodeId()) SoundManager::instance()->play("msg_incoming"); if (m_messageList) { @@ -442,8 +440,6 @@ void MainWindow::onAutoConnectStatus(uint8_t status, uint16_t /*total_tried*/, void MainWindow::onChannelPeersOnline(const char* ch_id, int ch_id_len, uint16_t online) { if (m_channelList) { QString cid = QString::fromUtf8(ch_id, ch_id_len); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "MainWindow::onChannelPeersOnline cid=%s online=%u", - qPrintable(cid), online); m_channelList->setChannelPeersOnline(cid, (int)online); } } diff --git a/tools/chatgui/src/messagelist.cpp b/tools/chatgui/src/messagelist.cpp index 2a5706d0..bf53f9be 100644 --- a/tools/chatgui/src/messagelist.cpp +++ b/tools/chatgui/src/messagelist.cpp @@ -659,9 +659,9 @@ void MessageList::updateReadPosition() { void MessageList::cleanupAnimations() { size_t n = s_icons.size(); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "MessageList: cleanupAnimations clearing %zu icons", n); + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "MessageList: cleanupAnimations clearing %zu icons", n); s_icons.clear(); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "MessageList: cleanupAnimations done"); + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "MessageList: cleanupAnimations done"); } void MessageList::updateMessageProgress(const QString& chId, int64_t msgId, diff --git a/tools/chatgui/src/sound_manager.cpp b/tools/chatgui/src/sound_manager.cpp index 3b3787a7..913925e1 100644 --- a/tools/chatgui/src/sound_manager.cpp +++ b/tools/chatgui/src/sound_manager.cpp @@ -11,7 +11,7 @@ SoundManager* SoundManager::instance() { } SoundManager::~SoundManager() { - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "SoundManager: static destructor entered"); + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "SoundManager: static destructor entered"); shutdown(); } @@ -43,14 +43,14 @@ void SoundManager::shutdown() { } m_sounds.clear(); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "SoundManager: before ma_engine_uninit engine=%p", (void*)m_engine); + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "SoundManager: before ma_engine_uninit engine=%p", (void*)m_engine); if (m_engine) { ma_engine_uninit(m_engine); delete m_engine; m_engine = nullptr; } if (m_currentPcmSound) { delete m_currentPcmSound; m_currentPcmSound = nullptr; } if (m_currentPcmBuffer) { ma_audio_buffer* buf = (ma_audio_buffer*)m_currentPcmBuffer; ma_audio_buffer_uninit(buf); delete buf; m_currentPcmBuffer = nullptr; } - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "SoundManager: after ma_engine_uninit"); + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "SoundManager: after ma_engine_uninit"); m_initialized = false; } diff --git a/tools/chatgui/transport/gui_bridge_impl.cpp b/tools/chatgui/transport/gui_bridge_impl.cpp index f6ca0b1e..98b738c4 100644 --- a/tools/chatgui/transport/gui_bridge_impl.cpp +++ b/tools/chatgui/transport/gui_bridge_impl.cpp @@ -55,7 +55,7 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) { uint64_t author = 0; memcpy(&author, d + 1 + chLen, 8); QString chId = QString::fromUtf8((const char*)d + 1, chLen); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: MSG_RECEIVED ch=%s author=%llu", + DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "gui_bridge: MSG_RECEIVED ch=%s author=%llu", qPrintable(chId), (unsigned long long)author); if (g_msg_received_cb) g_msg_received_cb((const char*)d + 1, chLen, author); } else { @@ -69,7 +69,7 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) { if (dlen >= 20) { uint64_t nodeId, channelId; int result; memcpy(&nodeId, d, 8); memcpy(&result, d + 8, 4); memcpy(&channelId, d + 12, 8); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: CONNECT_RESULT node=0x%016llx ch=%llu result=%d", + DEBUG_INFO(DEBUG_CATEGORY_MEMBER_SYNC, "gui_bridge: CONNECT_RESULT node=0x%016llx ch=%llu result=%d", (unsigned long long)nodeId, (unsigned long long)channelId, result); if (g_connect_result_cb) g_connect_result_cb(nodeId, channelId, result); } else { @@ -79,7 +79,7 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) { case GUI_EVT_NEW_PEER: if (dlen >= 8) { uint64_t nodeId; memcpy(&nodeId, d, 8); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: NEW_PEER node=0x%016llx", (unsigned long long)nodeId); + DEBUG_INFO(DEBUG_CATEGORY_MEMBER_SYNC, "gui_bridge: NEW_PEER node=0x%016llx", (unsigned long long)nodeId); } else { DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "gui_bridge: NEW_PEER data too short %d", dlen); } @@ -89,7 +89,7 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) { uint8_t chLen = d[0]; if (dlen >= 1 + chLen) { QString chId = QString::fromUtf8((const char*)d + 1, chLen); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: CHANNEL_UPDATED ch=%s", qPrintable(chId)); + DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "gui_bridge: CHANNEL_UPDATED ch=%s", qPrintable(chId)); if (g_channel_updated_cb) g_channel_updated_cb((const char*)d + 1, chLen); } } else { @@ -118,7 +118,7 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) { uint16_t node_count; memcpy(&node_count, d + 3, 2); uint16_t connected; memcpy(&connected, d + 5, 2); const char* st_str = status == 0 ? "in_progress" : status == 1 ? "done" : "stopped"; - if (status != 0) DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: AUTO_CONNECT %s tried=%u/%u connected=%u", st_str, total_tried, node_count, connected); + if (status != 0) DEBUG_INFO(DEBUG_CATEGORY_MEMBER_SYNC, "gui_bridge: AUTO_CONNECT %s tried=%u/%u connected=%u", st_str, total_tried, node_count, connected); if (g_auto_connect_status_cb) g_auto_connect_status_cb(status, total_tried, node_count, connected); } break; @@ -127,13 +127,19 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) { uint8_t chLen = d[0]; if (dlen >= 3 + chLen) { uint16_t online; memcpy(&online, d + 1 + chLen, 2); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: CHANNEL_PEERS_ONLINE ch=%.*s online=%u", chLen, (const char*)d + 1, online); + static char lastChId[256] = {0}; + static uint16_t lastOnline = 0xFFFF; + if (chLen != (uint8_t)strlen(lastChId) || memcmp(lastChId, d + 1, chLen) != 0 || online != lastOnline) { + memcpy(lastChId, d + 1, chLen); lastChId[chLen] = '\0'; + lastOnline = online; + DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "gui_bridge: CHANNEL_PEERS_ONLINE ch=%.*s online=%u", chLen, (const char*)d + 1, online); + } if (g_channel_peers_online_cb) g_channel_peers_online_cb((const char*)d + 1, chLen, online); } } break; case GUI_EVT_DB_READY: - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: DB_READY"); + DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "gui_bridge: DB_READY (chat DB tables created)"); if (g_db_ready_cb) g_db_ready_cb(); break; case GUI_EVT_STATUS_REFRESH: @@ -142,7 +148,7 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) { case GUI_EVT_NODE_CHANGED: if (dlen >= 8) { uint64_t nodeId; memcpy(&nodeId, d, 8); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: NODE_CHANGED node=0x%016llx — pubkey changed, connection closed", (unsigned long long)nodeId); + DEBUG_INFO(DEBUG_CATEGORY_MEMBER_SYNC, "gui_bridge: NODE_CHANGED node=0x%016llx — pubkey changed, connection closed", (unsigned long long)nodeId); } else { DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "gui_bridge: NODE_CHANGED data too short %d", dlen); } @@ -213,7 +219,6 @@ void gui_bridge_post_uasync_fn(void (*fn)(void*), void* arg) { } if (!fn) return; uasync_post(g_ua, fn, arg); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge_post_uasync_fn: posted fn=%p arg=%p", (void*)fn, arg); } int gui_bridge_is_uasync_ready(void) { diff --git a/tools/chatgui/transport/utun_node.cpp b/tools/chatgui/transport/utun_node.cpp index 0196e096..9e206dfd 100644 --- a/tools/chatgui/transport/utun_node.cpp +++ b/tools/chatgui/transport/utun_node.cpp @@ -102,7 +102,7 @@ void UtunNode::stop() { void UtunNode::finalize() { if (!m_instance) return; - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "finalize: cleanup start"); + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "finalize: cleanup start"); etcp_router_bind(m_instance, ETCP_RT_ID_CHAT, nullptr); chat_sync_destroy(m_instance); chat_core_destroy(m_instance); @@ -110,7 +110,7 @@ void UtunNode::finalize() { m_instance = nullptr; uasync_destroy(m_ua, 0); m_ua = nullptr; - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "finalize: cleanup done"); + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "finalize: cleanup done"); } void UtunNode::send(uint64_t dstNodeId, const QByteArray& data) { @@ -283,8 +283,7 @@ void UtunNode::runLoop() { } /* chatgui defaults: suppress spam, verbose for our categories */ - g_debug_config.category_levels[DEBUG_CATEGORY_MEMORY] = DEBUG_LEVEL_DISABLED; - g_debug_config.category_levels[DEBUG_CATEGORY_TIMING] = DEBUG_LEVEL_DISABLED; + g_debug_config.category_levels[DEBUG_CATEGORY_SYS] = DEBUG_LEVEL_DISABLED; g_debug_config.category_levels[DEBUG_CATEGORY_BGP] = DEBUG_LEVEL_INFO; /* per-category overrides from config: cat=level,cat=level,... */ @@ -360,9 +359,9 @@ void UtunNode::runLoop() { sqlite3_exec(m_instance->topo_sqlite_db, "PRAGMA synchronous=NORMAL", NULL, NULL, NULL); sqlite3_exec(m_instance->topo_sqlite_db, "PRAGMA wal_autocheckpoint=10000", NULL, NULL, NULL); topo_node_sqlite_init(m_instance->topo_sqlite_db); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "SQLite (shared): %s db=%p", db_file, (void*)m_instance->topo_sqlite_db); + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "SQLite (shared): %s db=%p", db_file, (void*)m_instance->topo_sqlite_db); } else { - DEBUG_ERROR(DEBUG_CATEGORY_DEBUG, "SQLite open failed: %s rc=%d", db_file, rc); + DEBUG_ERROR(DEBUG_CATEGORY_GENERAL, "SQLite open failed: %s rc=%d", db_file, rc); if (m_instance->topo_sqlite_db) { sqlite3_close(m_instance->topo_sqlite_db); m_instance->topo_sqlite_db = NULL; } } } @@ -381,7 +380,7 @@ void UtunNode::runLoop() { } { int sock_count = 0; for (struct ETCP_SOCKET* s = m_instance->etcp_sockets; s; s = s->next) sock_count++; - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "utun_node: after instance_init, etcp_sockets=%d conns=%d", + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "utun_node: after instance_init, etcp_sockets=%d conns=%d", sock_count, queue_entry_count(m_instance->connections)); } etcp_router_bind(m_instance, ETCP_RT_ID_CHAT, recvCallback); @@ -398,8 +397,8 @@ void UtunNode::runLoop() { chat_sync_init(m_instance); chat_core_sync_my_addresses(); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "chat_core + chat_sync initialized"); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "utun_node: entering poll loop"); + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "chat_core + chat_sync initialized"); + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "utun_node: entering poll loop"); signal(SIGINT, signal_handler); signal(SIGTERM, signal_handler); @@ -408,11 +407,11 @@ void UtunNode::runLoop() { uasync_poll(ua, 100); } - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "runLoop: poll exit m_stop=%d", (int)m_stop); + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "runLoop: poll exit m_stop=%d", (int)m_stop); signal(SIGINT, SIG_DFL); signal(SIGTERM, SIG_DFL); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "runLoop: emitting stopped"); + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "runLoop: emitting stopped"); QMetaObject::invokeMethod(this, [this] { emit stopped(); }); }