]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
better reconnect logic/less network & log spam
authorgg <chown_tee@proton.me>
Wed, 14 Jan 2026 18:18:07 +0000 (13:18 -0500)
committergg <chown_tee@proton.me>
Wed, 14 Jan 2026 18:18:07 +0000 (13:18 -0500)
src/MainWindow.cpp
src/utils/nodes.cpp

index fe200e3b76d4f21c5a6c21d17d4ca7595c22fa23..e4d6d9435aa3470c6fc0e5bedf89a6daecbe208a 100644 (file)
@@ -227,7 +227,6 @@ void MainWindow::initStatusBar() {
     m_actionEnableWebsocket = new QAction(tr("Enable Websocket"), this);
     m_actionEnableWebsocket->setCheckable(true);
     m_actionEnableWebsocket->setChecked(!conf()->get(Config::disableWebsocket).toBool());
-    m_statusLabelStatus->addAction(m_actionEnableWebsocket);
 
     connect(m_actionEnableWebsocket, &QAction::toggled, this, [](bool checked){
         conf()->set(Config::disableWebsocket, !checked);
@@ -252,7 +251,7 @@ void MainWindow::initStatusBar() {
     QAction *scanTxAction = new QAction(tr("Import Transaction"), this);
     m_statusLabelStatus->addAction(scanTxAction);
 
-    m_updateNetworkInfoAction = new QAction(tr("Update Network Info"), this);
+    m_updateNetworkInfoAction = new QAction(tr("Scan Now"), this);
     m_updateNetworkInfoAction->setEnabled(!pauseSyncAction->isChecked());
     m_statusLabelStatus->addAction(m_updateNetworkInfoAction);
 
@@ -614,7 +613,9 @@ void MainWindow::initOffline() {
 
     connect(m_updateNetworkInfoAction, &QAction::triggered, this, [this]() {
         if (!m_wallet) return;
-        this->setStatusText(tr("Scanning (Fetching network info)..."));
+        qDebug() << "Scanning wallet...";
+        this->setStatusText(tr("Scanning..."));
+        QApplication::processEvents();  // Ensure status text is visible immediately
         m_wallet->updateNetworkStatus();
     });
 
index 6611d76d48ccf8e1bfbdaf377883662bf4ded1eb..323fa3465b42e8aa441d4ad42e6ebc43da293b13 100644 (file)
@@ -298,6 +298,15 @@ void Nodes::autoConnect(bool forceReconnect) {
     }
 
     if (status == Wallet::ConnectionStatus_Disconnected || forceReconnect) {
+        // If we had a working connection and it dropped (transient disconnect),
+        // try reconnecting to the same node instead of picking a new one
+        if (m_connection.isValid() && m_connection.isActive && !forceReconnect) {
+            qDebug() << "Transient disconnect, reconnecting to same node:" << m_connection.toAddress();
+            this->connectToNode(m_connection);
+            return;
+        }
+
+        // Otherwise, mark the failed node and pick a new one
         if (m_connection.isValid() && !forceReconnect) {
             m_recentFailures << m_connection.toAddress();
         }