mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-21 02:01:03 +07:00
25 lines
496 B
C++
25 lines
496 B
C++
|
|
#include "defines.h"
|
||
|
|
#include "localserver.h"
|
||
|
|
#include "systemservice.h"
|
||
|
|
|
||
|
|
SystemService::SystemService(int argc, char **argv)
|
||
|
|
: QtService<QCoreApplication>(argc, argv, SERVICE_NAME)
|
||
|
|
{
|
||
|
|
setServiceDescription("Service for AmneziaVPN");
|
||
|
|
}
|
||
|
|
|
||
|
|
void SystemService::start()
|
||
|
|
{
|
||
|
|
QCoreApplication* app = application();
|
||
|
|
m_localServer = new LocalServer(SERVICE_NAME);
|
||
|
|
|
||
|
|
if (!m_localServer->isRunning()) {
|
||
|
|
app->quit();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void SystemService::stop()
|
||
|
|
{
|
||
|
|
delete m_localServer;
|
||
|
|
}
|