projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
identd: Cleanup
[quassel.git]
/
src
/
core
/
core.cpp
diff --git
a/src/core/core.cpp
b/src/core/core.cpp
index
48e4f0f
..
e3c7931
100644
(file)
--- a/
src/core/core.cpp
+++ b/
src/core/core.cpp
@@
-81,6
+81,12
@@
Core::Core()
delete _instance;
}
_instance = this;
delete _instance;
}
_instance = this;
+
+ // Parent all QObject-derived attributes, so when the Core instance gets moved into another
+ // thread, they get moved with it
+ _server.setParent(this);
+ _v6server.setParent(this);
+ _storageSyncTimer.setParent(this);
}
}
@@
-98,7
+104,9
@@
bool Core::init()
{
_startTime = QDateTime::currentDateTime().toUTC(); // for uptime :)
{
_startTime = QDateTime::currentDateTime().toUTC(); // for uptime :)
- Quassel::loadTranslation(QLocale::system());
+ if (Quassel::runMode() == Quassel::RunMode::CoreOnly) {
+ Quassel::loadTranslation(QLocale::system());
+ }
// check settings version
// so far, we only have 1
// check settings version
// so far, we only have 1
@@
-214,6
+222,11
@@
bool Core::init()
_oidentdConfigGenerator = new OidentdConfigGenerator(this);
}
_oidentdConfigGenerator = new OidentdConfigGenerator(this);
}
+
+ if (Quassel::isOptionSet("ident-daemon")) {
+ _identServer = new IdentServer(_strictIdentEnabled, this);
+ }
+
Quassel::registerReloadHandler([]() {
// Currently, only reloading SSL certificates and the sysident cache is supported
if (Core::instance()) {
Quassel::registerReloadHandler([]() {
// Currently, only reloading SSL certificates and the sysident cache is supported
if (Core::instance()) {
@@
-240,6
+253,13
@@
bool Core::init()
Core::restoreState();
}
Core::restoreState();
}
+ _initialized = true;
+
+ if (_pendingInternalConnection) {
+ connectInternalPeer(_pendingInternalConnection);
+ _pendingInternalConnection = {};
+ }
+
return true;
}
return true;
}
@@
-391,6
+411,8
@@
bool Core::initStorage(const QString &backend, const QVariantMap &settings,
return false;
}
return false;
}
+ connect(storage.get(), SIGNAL(dbUpgradeInProgress(bool)), this, SIGNAL(dbUpgradeInProgress(bool)));
+
Storage::State storageState = storage->init(settings, environment, loadFromEnvironment);
switch (storageState) {
case Storage::NeedsSetup:
Storage::State storageState = storage->init(settings, environment, loadFromEnvironment);
switch (storageState) {
case Storage::NeedsSetup:
@@
-648,12
+670,20
@@
bool Core::startListening()
if (!success)
quError() << qPrintable(tr("Could not open any network interfaces to listen on!"));
if (!success)
quError() << qPrintable(tr("Could not open any network interfaces to listen on!"));
+ if (_identServer) {
+ _identServer->startListening();
+ }
+
return success;
}
void Core::stopListening(const QString &reason)
{
return success;
}
void Core::stopListening(const QString &reason)
{
+ if (_identServer) {
+ _identServer->stopListening(reason);
+ }
+
bool wasListening = false;
if (_server.isListening()) {
wasListening = true;
bool wasListening = false;
if (_server.isListening()) {
wasListening = true;
@@
-752,7
+782,18
@@
void Core::addClientHelper(RemotePeer *peer, UserId uid)
}
}
-void Core::setupInternalClientSession(InternalPeer *clientPeer)
+void Core::connectInternalPeer(QPointer<InternalPeer> peer)
+{
+ if (_initialized && peer) {
+ setupInternalClientSession(peer);
+ }
+ else {
+ _pendingInternalConnection = peer;
+ }
+}
+
+
+void Core::setupInternalClientSession(QPointer<InternalPeer> clientPeer)
{
if (!_configured) {
stopListening();
{
if (!_configured) {
stopListening();
@@
-765,6
+806,12
@@
void Core::setupInternalClientSession(InternalPeer *clientPeer)
}
else {
quWarning() << "Core::setupInternalClientSession(): You're trying to run monolithic Quassel with an unusable Backend! Go fix it!";
}
else {
quWarning() << "Core::setupInternalClientSession(): You're trying to run monolithic Quassel with an unusable Backend! Go fix it!";
+ QCoreApplication::exit(EXIT_FAILURE);
+ return;
+ }
+
+ if (!clientPeer) {
+ quWarning() << "Client peer went away, not starting a session";
return;
}
return;
}