mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-08 14:33:23 +00:00
* Add network status check for AWG/WG protocol * Use service for PingSender * Cleanup unused code * Use networkchecker for all protocols * fix android build * add delay for ping checker stop * handle for interafe problems on windows * Restart IpcClient after OS suspend * Add DBus network checker for Linux * Use ping check for tun interfce * Windows suspend mode handler * MacOS suspend mode handler draft * Add delay for Linux wakeup reconnect * Add delay for Linux wakeup reconnect * Fix macOS wakeup/sleep prob Fix macOS not receiving wakeup/sleep events * fix done * Update deploy.yml fix CICD * Update vpnconnection.cpp update fix build CICD * Update vpnconnection.cpp update fix build cicd macos * Update deploy.yml fix CICD build macos * Update deploy.yml fix CICD macos * feat: implement SCP write buffer, improve network check and refactor macOS OpenGL support * feat: add tunnel addresses updated signal and handle network check based on gateway and local address availability * refactor: improve IpcClient connection handling and instance management * fix: scp revert. * fix: cmake reverted. * fix: submodules updated --------- Co-authored-by: Mykola Baibuz <mykola.baibuz@gmail.com> Co-authored-by: Yaroslav Yashin <yaroslav.yashin@gmail.com> Co-authored-by: vkamn <vk@amnezia.org>
61 lines
1.7 KiB
C++
61 lines
1.7 KiB
C++
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "linuxnetworkwatcher.h"
|
|
|
|
#include <QTimer>
|
|
|
|
#include "leakdetector.h"
|
|
#include "linuxnetworkwatcherworker.h"
|
|
#include "logger.h"
|
|
|
|
namespace {
|
|
Logger logger("LinuxNetworkWatcher");
|
|
}
|
|
|
|
LinuxNetworkWatcher::LinuxNetworkWatcher(QObject* parent)
|
|
: NetworkWatcherImpl(parent) {
|
|
MZ_COUNT_CTOR(LinuxNetworkWatcher);
|
|
|
|
m_thread.start();
|
|
}
|
|
|
|
LinuxNetworkWatcher::~LinuxNetworkWatcher() {
|
|
MZ_COUNT_DTOR(LinuxNetworkWatcher);
|
|
|
|
delete m_worker;
|
|
|
|
m_thread.quit();
|
|
m_thread.wait();
|
|
}
|
|
|
|
void LinuxNetworkWatcher::initialize() {
|
|
logger.debug() << "initialize";
|
|
|
|
m_worker = new LinuxNetworkWatcherWorker(&m_thread);
|
|
|
|
connect(this, &LinuxNetworkWatcher::checkDevicesInThread, m_worker,
|
|
&LinuxNetworkWatcherWorker::checkDevices);
|
|
|
|
connect(m_worker, &LinuxNetworkWatcherWorker::unsecuredNetwork, this,
|
|
&LinuxNetworkWatcher::unsecuredNetwork);
|
|
|
|
connect(m_worker, &LinuxNetworkWatcherWorker::sleepMode, this,
|
|
&NetworkWatcherImpl::sleepMode);
|
|
|
|
// Let's wait a few seconds to allow the UI to be fully loaded and shown.
|
|
// This is not strictly needed, but it's better for user experience because
|
|
// it makes the UI faster to appear, plus it gives a bit of delay between the
|
|
// UI to appear and the first notification.
|
|
QTimer::singleShot(2000, this, [this]() {
|
|
QMetaObject::invokeMethod(m_worker, "initialize", Qt::QueuedConnection);
|
|
});
|
|
}
|
|
|
|
void LinuxNetworkWatcher::start() {
|
|
logger.debug() << "actived";
|
|
NetworkWatcherImpl::start();
|
|
emit checkDevicesInThread();
|
|
}
|