mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-08 14:33:23 +00:00
fix: restore reconnect time
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
#include "protocols/protocols_defs.h"
|
||||
|
||||
// How many times do we try to reconnect.
|
||||
constexpr int MAX_CONNECTION_RETRY = 70;
|
||||
constexpr int MAX_CONNECTION_RETRY = 10;
|
||||
|
||||
// How long do we wait between one try and the next one.
|
||||
constexpr int CONNECTION_RETRY_TIMER_MSEC = 500;
|
||||
|
||||
@@ -210,7 +210,6 @@ void LinuxNetworkWatcherWorker::NMStateChanged(quint32 state)
|
||||
logger.debug() << "NMStateChanged " << state;
|
||||
|
||||
if (state == NM_STATE_ASLEEP) {
|
||||
// Invalidate any in-flight gateway poll before emitting wakeup.
|
||||
++m_pollGeneration;
|
||||
emit wakeup();
|
||||
} else if (state >= NM_STATE_CONNECTED_SITE && m_previousNMState < NM_STATE_CONNECTED_SITE) {
|
||||
@@ -225,7 +224,7 @@ void LinuxNetworkWatcherWorker::NMStateChanged(quint32 state)
|
||||
|
||||
void LinuxNetworkWatcherWorker::checkGatewayAndEmit(int generation, int count) {
|
||||
if (m_pollGeneration.load() != generation) {
|
||||
return; // cancelled by a newer connect/disconnect event
|
||||
return;
|
||||
}
|
||||
|
||||
++count;
|
||||
|
||||
@@ -44,7 +44,6 @@ class LinuxNetworkWatcherWorker final : public QObject {
|
||||
// point is active and unsecure.
|
||||
QStringList m_devicePaths;
|
||||
quint32 m_previousNMState = 0;
|
||||
// Incremented on every connect/disconnect event to cancel in-flight polls.
|
||||
std::atomic<int> m_pollGeneration{0};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user