@@ -708,11 +708,18 @@ void MainWindow::requestWanReconnect()
708708 if (m_userDisconnected || m_radioModel.isConnected()
709709 || m_pendingWanRadio.serial.isEmpty()) {
710710 m_wanReconnectTimer.stop();
711+ m_wanReconnectAttemptInProgress = false;
711712 return;
712713 }
713714
714- m_connPanel->setStatusText("Reconnecting via SmartLink...");
715- setPanadapterConnectionAnimation(true, "Reconnecting to remote radio...");
715+ if (m_wanReconnectAttemptInProgress) {
716+ m_wanReconnectTimer.start();
717+ return;
718+ }
719+
720+ m_connPanel->setStatusText("Reconnecting via SmartLink…");
721+ setPanadapterConnectionAnimation(true, "Reconnecting to remote radio…");
722+ m_wanReconnectAttemptInProgress = true;
716723
717724 if (!m_smartLink.isConnected()) {
718725 m_smartLink.reconnect();
@@ -1129,6 +1136,7 @@ MainWindow::MainWindow(QWidget* parent)
11291136 this, [this]{
11301137 m_userDisconnected = true;
11311138 m_wanReconnectTimer.stop();
1139+ m_wanReconnectAttemptInProgress = false;
11321140 setPanadapterConnectionAnimation(false);
11331141 auto& s = AppSettings::instance();
11341142 s.remove("LastConnectedRadioSerial");
@@ -1151,6 +1159,7 @@ MainWindow::MainWindow(QWidget* parent)
11511159 }
11521160
11531161 m_wanReconnectTimer.stop();
1162+ m_wanReconnectAttemptInProgress = false;
11541163 m_connPanel->setStatusText("SmartLink sign-in required");
11551164 statusBar()->showMessage("SmartLink reconnect stopped: " + err, 5000);
11561165 setPanadapterConnectionAnimation(false);
@@ -1161,6 +1170,14 @@ MainWindow::MainWindow(QWidget* parent)
11611170 }
11621171 m_connPanel->show();
11631172 });
1173+ connect(&m_smartLink, &SmartLinkClient::serverConnected,
1174+ this, [this] {
1175+ m_wanReconnectAttemptInProgress = false;
1176+ });
1177+ connect(&m_smartLink, &SmartLinkClient::serverDisconnected,
1178+ this, [this] {
1179+ m_wanReconnectAttemptInProgress = false;
1180+ });
11641181
11651182 connect(m_connPanel, &ConnectionPanel::smartLinkLoginRequested,
11661183 this, [this](const QString& email, const QString& pass) {
@@ -1198,6 +1215,7 @@ MainWindow::MainWindow(QWidget* parent)
11981215 connect(&m_smartLink, &SmartLinkClient::connectReady,
11991216 this, [this](const QString& handle, const QString& serial) {
12001217 if (serial != m_pendingWanRadio.serial) return;
1218+ m_wanReconnectAttemptInProgress = false;
12011219 m_connPanel->setStatusText("TLS connecting to radio…");
12021220 setPanadapterConnectionAnimation(true, "Connecting to remote radio…");
12031221 m_wanConnection.connectToRadio(
@@ -1212,6 +1230,7 @@ MainWindow::MainWindow(QWidget* parent)
12121230 connect(&m_wanConnection, &WanConnection::connected, this, [this] {
12131231 qDebug() << "MainWindow: WAN connection established!";
12141232 m_wanReconnectTimer.stop();
1233+ m_wanReconnectAttemptInProgress = false;
12151234 m_connPanel->setStatusText("Connected via SmartLink");
12161235 m_connPanel->setConnected(true);
12171236
@@ -1223,6 +1242,7 @@ MainWindow::MainWindow(QWidget* parent)
12231242 });
12241243 connect(&m_wanConnection, &WanConnection::disconnected, this, [this] {
12251244 qDebug() << "MainWindow: WAN connection lost";
1245+ m_wanReconnectAttemptInProgress = false;
12261246 m_connPanel->setStatusText("SmartLink disconnected");
12271247 m_connPanel->setConnected(false);
12281248 if (m_userDisconnected) {
@@ -4178,6 +4198,7 @@ void MainWindow::closeEvent(QCloseEvent* event)
41784198 // Suppress reconnect dialog during shutdown (#527)
41794199 m_userDisconnected = true;
41804200 m_wanReconnectTimer.stop();
4201+ m_wanReconnectAttemptInProgress = false;
41814202 if (m_reconnectDlg) {
41824203 m_reconnectDlg->close();
41834204 delete m_reconnectDlg;
@@ -7166,6 +7187,7 @@ void MainWindow::onConnectionStateChanged(bool connected)
71667187 const bool reconnectWan = !m_userDisconnected && m_radioModel.isWan()
71677188 && !m_pendingWanRadio.serial.isEmpty();
71687189 if (reconnectWan && !m_wanReconnectTimer.isActive()) {
7190+ m_wanReconnectAttemptInProgress = false;
71697191 m_wanReconnectTimer.start();
71707192 }
71717193
@@ -7240,6 +7262,7 @@ void MainWindow::onConnectionStateChanged(bool connected)
72407262 connect(dismissBtn, &QPushButton::clicked, this, [this]() {
72417263 m_userDisconnected = true;
72427264 m_wanReconnectTimer.stop();
7265+ m_wanReconnectAttemptInProgress = false;
72437266 setPanadapterConnectionAnimation(false);
72447267 m_reconnectDlg->close();
72457268 m_reconnectDlg->deleteLater();
0 commit comments