custom sitet pre release

This commit is contained in:
pokamest 2021-06-01 18:18:09 +03:00
parent 34b97bdc24
commit 9dbe15a0e3
156 changed files with 5404 additions and 326 deletions

View file

@ -7,10 +7,9 @@ class IpcInterface
//SIGNAL(sendMessage(const QByteArray &message));
// Route functions
SLOT( bool routeAdd(const QString &ip, const QString &gw) );
SLOT( int routeAddList(const QString &gw, const QStringList &ips) );
SLOT( bool clearSavedRoutes() );
SLOT( bool routeDelete(const QString &ip, const QString &gw) );
SLOT( bool routeDeleteList(const QString &gw, const QStringList &ip) );
SLOT( void flushDns() );
SLOT( bool checkAndInstallDriver() );

View file

@ -31,14 +31,6 @@ int IpcServer::createPrivilegedProcess()
return -1;
}
// connect(m_server.data(), &QLocalServer::newConnection, this, &LocalServer::onNewConnection);
// qDebug().noquote() << QString("Local server started on '%1'").arg(m_server->serverName());
// m_serverNode.setHostUrl(QUrl(QStringLiteral(IPC_SERVICE_URL))); // create host node without Registry
// Make sure any connections are handed to QtRO
QObject::connect(pd.localServer.data(), &QLocalServer::newConnection, this, [pd]() {
qDebug() << "LocalServer new connection";
@ -48,16 +40,29 @@ int IpcServer::createPrivilegedProcess()
}
});
QObject::connect(pd.serverNode.data(), &QRemoteObjectHost::error, this, [pd](QRemoteObjectNode::ErrorCode errorCode) {
qDebug() << "QRemoteObjectHost::error" << errorCode;
});
QObject::connect(pd.serverNode.data(), &QRemoteObjectHost::destroyed, this, [pd]() {
qDebug() << "QRemoteObjectHost::destroyed";
});
connect(pd.ipcProcess.data(), &IpcServerProcess::finished, this, [this, pid=m_localpid](int exitCode, QProcess::ExitStatus exitStatus){
qDebug() << "IpcServerProcess finished" << exitCode << exitStatus;
// if (m_processes.contains(pid)) {
// m_processes[pid].ipcProcess.reset();
// m_processes[pid].serverNode.reset();
// m_processes[pid].localServer.reset();
// m_processes.remove(pid);
// }
});
m_processes.insert(m_localpid, pd);
return m_localpid;
}
bool IpcServer::routeAdd(const QString &ip, const QString &gw)
{
return Router::routeAdd(ip, gw);
}
int IpcServer::routeAddList(const QString &gw, const QStringList &ips)
{
return Router::routeAddList(gw, ips);
@ -68,9 +73,9 @@ bool IpcServer::clearSavedRoutes()
return Router::clearSavedRoutes();
}
bool IpcServer::routeDelete(const QString &ip, const QString &gw)
bool IpcServer::routeDeleteList(const QString &gw, const QStringList &ips)
{
return Router::routeDelete(ip, gw);
return Router::routeDeleteList(gw ,ips);
}
void IpcServer::flushDns()

View file

@ -3,6 +3,7 @@
#include <QLocalServer>
#include <QObject>
#include <QRemoteObjectNode>
#include "ipc.h"
#include "ipcserverprocess.h"
@ -15,10 +16,9 @@ public:
explicit IpcServer(QObject *parent = nullptr);
virtual int createPrivilegedProcess() override;
virtual bool routeAdd(const QString &ip, const QString &gw) override;
virtual int routeAddList(const QString &gw, const QStringList &ips) override;
virtual bool clearSavedRoutes() override;
virtual bool routeDelete(const QString &ip, const QString &gw) override;
virtual bool routeDeleteList(const QString &gw, const QStringList &ips) override;
virtual void flushDns() override;
virtual bool checkAndInstallDriver() override;
virtual QStringList getTapList() override;
@ -32,6 +32,7 @@ private:
ipcProcess = QSharedPointer<IpcServerProcess>(new IpcServerProcess(parent));
localServer = QSharedPointer<QLocalServer>(new QLocalServer(parent));
}
QSharedPointer<IpcServerProcess> ipcProcess;
QSharedPointer<QRemoteObjectHost> serverNode;
QSharedPointer<QLocalServer> localServer;

View file

@ -16,27 +16,31 @@ IpcServerProcess::IpcServerProcess(QObject *parent) :
qDebug() << "IpcServerProcess errorOccurred " << error;
});
connect(m_process.data(), &QProcess::readyReadStandardError, [&](){
connect(m_process.data(), &QProcess::readyReadStandardError, this, [this](){
qDebug() << "IpcServerProcess StandardError " << m_process->readAllStandardError();
});
connect(m_process.data(), &QProcess::readyReadStandardOutput, [&](){
connect(m_process.data(), &QProcess::readyReadStandardOutput, this, [this](){
qDebug() << "IpcServerProcess StandardOutput " << m_process->readAllStandardOutput();
});
connect(m_process.data(), &QProcess::readyRead, [&](){
connect(m_process.data(), &QProcess::readyRead, this, [this](){
qDebug() << "IpcServerProcess StandardOutput " << m_process->readAll();
});
}
IpcServerProcess::~IpcServerProcess()
{
qDebug() << "IpcServerProcess::~IpcServerProcess";
}
void IpcServerProcess::start(const QString &program, const QStringList &arguments)
{
m_process->start(program, arguments);
qDebug() << "IpcServerProcess started, " << arguments;
m_process->waitForStarted();
qDebug() << "waitForStarted started, " << m_process->errorString();
}
void IpcServerProcess::start()
@ -45,7 +49,6 @@ void IpcServerProcess::start()
qDebug() << "IpcServerProcess started, " << m_process->program() << m_process->arguments();
m_process->waitForStarted();
qDebug() << "waitForStarted , " << m_process->errorString() << m_process->error();
}
void IpcServerProcess::close()
@ -70,7 +73,6 @@ void IpcServerProcess::setNativeArguments(const QString &arguments)
#endif
}
void IpcServerProcess::setProcessChannelMode(QProcess::ProcessChannelMode mode)
{
m_process->setProcessChannelMode(mode);

View file

@ -10,6 +10,7 @@ class IpcServerProcess : public IpcProcessInterfaceSource
Q_OBJECT
public:
explicit IpcServerProcess(QObject *parent = nullptr);
virtual ~IpcServerProcess();
void start(const QString &program, const QStringList &arguments) override;
void start() override;