X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcore.cpp;h=a2b7283e2b51fe43fed72774efcb39ff6827fa77;hp=a4133eb12ecec93e6b37dfacff1630900d9c3906;hb=8dfdd498679c773cf2e7958c5fd434bf56f634e3;hpb=d1ecf9e978968e1ed82f1baee64f83d7f60c7017 diff --git a/src/core/core.cpp b/src/core/core.cpp index a4133eb1..a2b7283e 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2019 by the Quassel Project * + * Copyright (C) 2005-2020 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -213,6 +213,14 @@ void Core::init() _identServer = new IdentServer(this); } + if (Quassel::isOptionSet("metrics-daemon")) { + _metricsServer = new MetricsServer(this); +#ifdef HAVE_SSL + _server.setMetricsServer(_metricsServer); + _v6server.setMetricsServer(_metricsServer); +#endif + } + Quassel::registerReloadHandler([]() { // Currently, only reloading SSL certificates and the sysident cache is supported if (Core::instance()) { @@ -294,7 +302,7 @@ void Core::saveState() if (_storage) { QVariantList activeSessions; for (auto&& user : instance()->_sessions.keys()) - activeSessions << QVariant::fromValue(user); + activeSessions << QVariant::fromValue(user); _storage->setCoreState(activeSessions); } } @@ -674,6 +682,10 @@ bool Core::startListening() _identServer->startListening(); } + if (_metricsServer) { + _metricsServer->startListening(); + } + return success; } @@ -683,6 +695,10 @@ void Core::stopListening(const QString& reason) _identServer->stopListening(reason); } + if (_metricsServer) { + _metricsServer->stopListening(reason); + } + bool wasListening = false; if (_server.isListening()) { wasListening = true; @@ -714,7 +730,7 @@ void Core::incomingConnection() connect(handler, &AuthHandler::socketError, this, &Core::socketError); connect(handler, &CoreAuthHandler::handshakeComplete, this, &Core::setupClientSession); - qInfo() << qPrintable(tr("Client connected from")) << qPrintable(socket->peerAddress().toString()); + qInfo() << qPrintable(tr("Client connected from")) << qPrintable(handler->hostAddress().toString()); if (!_configured) { stopListening(tr("Closing server for basic setup.")); @@ -728,7 +744,7 @@ void Core::clientDisconnected() auto* handler = qobject_cast(sender()); Q_ASSERT(handler); - qInfo() << qPrintable(tr("Non-authed client disconnected:")) << qPrintable(handler->socket()->peerAddress().toString()); + qInfo() << qPrintable(tr("Non-authed client disconnected:")) << qPrintable(handler->hostAddress().toString()); _connectingClients.remove(handler); handler->deleteLater();