mirror of
https://github.com/arcan1s/queued.git
synced 2025-04-24 23:47:19 +00:00
add sighup catch to daemon
This commit is contained in:
parent
8031e60355
commit
a2872e7c23
@ -34,6 +34,7 @@ QueuedApplication::QueuedApplication(QObject *parent, const QVariantHash &args)
|
|||||||
qCDebug(LOG_APP) << metadata;
|
qCDebug(LOG_APP) << metadata;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
initDBus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -41,15 +42,14 @@ QueuedApplication::~QueuedApplication()
|
|||||||
{
|
{
|
||||||
qCDebug(LOG_APP) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_APP) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
|
QDBusConnection::sessionBus().unregisterObject(
|
||||||
|
QueuedConfig::DBUS_APPLICATION_PATH);
|
||||||
deinit();
|
deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QueuedApplication::deinit()
|
void QueuedApplication::deinit()
|
||||||
{
|
{
|
||||||
QDBusConnection::sessionBus().unregisterObject(
|
|
||||||
QueuedConfig::DBUS_APPLICATION_PATH);
|
|
||||||
|
|
||||||
if (m_core)
|
if (m_core)
|
||||||
delete m_core;
|
delete m_core;
|
||||||
}
|
}
|
||||||
@ -60,7 +60,6 @@ void QueuedApplication::init()
|
|||||||
deinit();
|
deinit();
|
||||||
|
|
||||||
initCore();
|
initCore();
|
||||||
initDBus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,10 +25,14 @@
|
|||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QueuedApplication *instance = nullptr;
|
||||||
|
|
||||||
|
|
||||||
bool existingSessionOperation(const QString &operation)
|
bool existingSessionOperation(const QString &operation)
|
||||||
{
|
{
|
||||||
QVariantList arguments = QueuedCoreAdaptor::sendRequest(
|
QVariantList arguments = QueuedCoreAdaptor::sendRequest(
|
||||||
@ -108,6 +112,11 @@ int main(int argc, char *argv[])
|
|||||||
QVariantHash arguments = {{"config", parser.value(configOption)}};
|
QVariantHash arguments = {{"config", parser.value(configOption)}};
|
||||||
|
|
||||||
// start application
|
// start application
|
||||||
QueuedApplication instance(nullptr, arguments);
|
instance = new QueuedApplication(nullptr, arguments);
|
||||||
|
// catch SIGHUP
|
||||||
|
signal(SIGHUP, [](int sig) ->void {
|
||||||
|
qCInfo(LOG_APP) << "Received SIGHUP signal, reinit components";
|
||||||
|
instance->init();
|
||||||
|
});
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user