X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcore.cpp;h=e3c7931498c8acdb49274f8f8670d62229a20e99;hp=3089a73954e1d820316cede656e8fbdfdaef3aa3;hb=2e83624ce2642589a5b1f298e4993c51d22caafe;hpb=dbcfda6f073ab1c72d8dc0c3a9325c59f083642d diff --git a/src/core/core.cpp b/src/core/core.cpp index 3089a739..e3c79314 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -222,6 +222,11 @@ bool Core::init() _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()) { @@ -248,6 +253,13 @@ bool Core::init() Core::restoreState(); } + _initialized = true; + + if (_pendingInternalConnection) { + connectInternalPeer(_pendingInternalConnection); + _pendingInternalConnection = {}; + } + return true; } @@ -399,6 +411,8 @@ bool Core::initStorage(const QString &backend, const QVariantMap &settings, 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: @@ -656,12 +670,20 @@ bool Core::startListening() 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) { + if (_identServer) { + _identServer->stopListening(reason); + } + bool wasListening = false; if (_server.isListening()) { wasListening = true; @@ -760,7 +782,18 @@ void Core::addClientHelper(RemotePeer *peer, UserId uid) } -void Core::setupInternalClientSession(InternalPeer *clientPeer) +void Core::connectInternalPeer(QPointer peer) +{ + if (_initialized && peer) { + setupInternalClientSession(peer); + } + else { + _pendingInternalConnection = peer; + } +} + + +void Core::setupInternalClientSession(QPointer clientPeer) { if (!_configured) { stopListening(); @@ -773,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!"; + QCoreApplication::exit(EXIT_FAILURE); + return; + } + + if (!clientPeer) { + quWarning() << "Client peer went away, not starting a session"; return; }