Use service for PingSender
This commit is contained in:
parent
e792117be1
commit
8bb4fa3f35
7 changed files with 46 additions and 47 deletions
|
@ -32,5 +32,9 @@ class IpcInterface
|
|||
SLOT( bool enablePeerTraffic( const QJsonObject &configStr) );
|
||||
SLOT( bool enableKillSwitch( const QJsonObject &excludeAddr, int vpnAdapterIndex) );
|
||||
SLOT( bool updateResolvers(const QString& ifname, const QList<QHostAddress>& resolvers) );
|
||||
SLOT( bool startNetworkCheck(const QString& serverIpv4Gateway, const QString& deviceIpv4Address) );
|
||||
SLOT( bool stopNetworkCheck() );
|
||||
|
||||
SIGNAL( connectionLose() );
|
||||
};
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
#endif
|
||||
|
||||
IpcServer::IpcServer(QObject *parent) : IpcInterfaceSource(parent)
|
||||
|
||||
{
|
||||
connect(&m_pingHelper, &PingHelper::connectionLose, this, &IpcServer::connectionLose);
|
||||
}
|
||||
|
||||
int IpcServer::createPrivilegedProcess()
|
||||
|
@ -188,6 +188,20 @@ void IpcServer::setLogsEnabled(bool enabled)
|
|||
}
|
||||
}
|
||||
|
||||
bool IpcServer::startNetworkCheck(const QString& serverIpv4Gateway, const QString& deviceIpv4Address)
|
||||
{
|
||||
m_pingHelper.start(serverIpv4Gateway, deviceIpv4Address);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IpcServer::stopNetworkCheck()
|
||||
{
|
||||
|
||||
qDebug() << "stopNetworkCheck";
|
||||
m_pingHelper.stop();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IpcServer::enableKillSwitch(const QJsonObject &configStr, int vpnAdapterIndex)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <QRemoteObjectNode>
|
||||
#include <QJsonObject>
|
||||
#include "../client/daemon/interfaceconfig.h"
|
||||
#include "../client/mozilla/pinghelper.h"
|
||||
|
||||
#include "ipc.h"
|
||||
#include "ipcserverprocess.h"
|
||||
|
@ -38,6 +39,11 @@ public:
|
|||
virtual bool enableKillSwitch(const QJsonObject &excludeAddr, int vpnAdapterIndex) override;
|
||||
virtual bool disableKillSwitch() override;
|
||||
virtual bool updateResolvers(const QString& ifname, const QList<QHostAddress>& resolvers) override;
|
||||
virtual bool startNetworkCheck(const QString& serverIpv4Gateway, const QString& deviceIpv4Address) override;
|
||||
virtual bool stopNetworkCheck() override;
|
||||
|
||||
signals:
|
||||
void ConnectionLose();
|
||||
|
||||
private:
|
||||
int m_localpid = 0;
|
||||
|
@ -57,6 +63,8 @@ private:
|
|||
};
|
||||
|
||||
QMap<int, ProcessDescriptor> m_processes;
|
||||
PingHelper m_pingHelper;
|
||||
|
||||
};
|
||||
|
||||
#endif // IPCSERVER_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue