Qt remote objects IPC
This commit is contained in:
parent
c4df9c004b
commit
048a673d31
18 changed files with 340 additions and 25 deletions
|
@ -11,8 +11,8 @@
|
|||
|
||||
|
||||
OpenVpnProtocol::OpenVpnProtocol(const QString& args, QObject* parent) :
|
||||
VpnProtocol(args, parent),
|
||||
m_requestFromUserToStop(false)
|
||||
VpnProtocol(args, parent)
|
||||
//m_requestFromUserToStop(false)
|
||||
{
|
||||
setConfigFile(args);
|
||||
connect(m_communicator, &Communicator::messageReceived, this, &OpenVpnProtocol::onMessageReceived);
|
||||
|
@ -130,14 +130,14 @@ ErrorCode OpenVpnProtocol::start()
|
|||
{
|
||||
qDebug() << "Start OpenVPN connection";
|
||||
|
||||
m_requestFromUserToStop = false;
|
||||
//m_requestFromUserToStop = false;
|
||||
m_openVpnStateSigTermHandlerTimer.stop();
|
||||
OpenVpnProtocol::stop();
|
||||
|
||||
if (communicator() && !communicator()->isConnected()) {
|
||||
setLastError(ErrorCode::AmneziaServiceConnectionFailed);
|
||||
return lastError();
|
||||
}
|
||||
// if (communicator() && !communicator()->isConnected()) {
|
||||
// setLastError(ErrorCode::AmneziaServiceConnectionFailed);
|
||||
// return lastError();
|
||||
// }
|
||||
|
||||
if (!QFileInfo::exists(openVpnExecPath())) {
|
||||
setLastError(ErrorCode::OpenVpnExecutableMissing);
|
||||
|
@ -165,7 +165,20 @@ ErrorCode OpenVpnProtocol::start()
|
|||
}
|
||||
|
||||
setConnectionState(ConnectionState::Connecting);
|
||||
m_communicator->sendMessage(Message(Message::State::StartRequest, args));
|
||||
|
||||
QSharedPointer<IpcProcessInterfaceReplica> process = IpcClient::createPrivilegedProcess();
|
||||
process->waitForSource(1000);
|
||||
if (!process->isInitialized()) {
|
||||
return ErrorCode::AmneziaServiceConnectionFailed;
|
||||
}
|
||||
process->setProgram(openVpnExecPath());
|
||||
process->setArguments(QStringList() << "--config" << configPath()<<
|
||||
"--management"<< m_managementHost<< QString::number(m_managementPort)<<
|
||||
"--management-client"<<
|
||||
"--log-append"<< vpnLogFileNamePath);
|
||||
process->start();
|
||||
|
||||
//m_communicator->sendMessage(Message(Message::State::StartRequest, args));
|
||||
startTimeoutTimer();
|
||||
|
||||
return ErrorCode::NoError;
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "message.h"
|
||||
#include "vpnprotocol.h"
|
||||
|
||||
#include "core/ipcclient.h"
|
||||
|
||||
class OpenVpnProtocol : public VpnProtocol
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -45,7 +47,7 @@ protected:
|
|||
ManagementServer m_managementServer;
|
||||
QString m_configFileName;
|
||||
QTimer m_openVpnStateSigTermHandlerTimer;
|
||||
bool m_requestFromUserToStop;
|
||||
//bool m_requestFromUserToStop;
|
||||
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue