mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 07:58:59 +02:00
delay critical quit messages until just prior to quit
This commit is contained in:
parent
99e9b3ecdd
commit
aaf8e60de3
3 changed files with 34 additions and 16 deletions
|
@ -120,6 +120,14 @@ DomainServer::~DomainServer() {
|
||||||
DependencyManager::destroy<LimitedNodeList>();
|
DependencyManager::destroy<LimitedNodeList>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DomainServer::queuedQuit(QString quitMessage, int exitCode) {
|
||||||
|
if (!quitMessage.isEmpty()) {
|
||||||
|
qCritical() << qPrintable(quitMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
QCoreApplication::exit(exitCode);
|
||||||
|
}
|
||||||
|
|
||||||
void DomainServer::aboutToQuit() {
|
void DomainServer::aboutToQuit() {
|
||||||
|
|
||||||
// clear the log handler so that Qt doesn't call the destructor on LogHandler
|
// clear the log handler so that Qt doesn't call the destructor on LogHandler
|
||||||
|
@ -164,8 +172,11 @@ bool DomainServer::optionallyReadX509KeyAndCertificate() {
|
||||||
qDebug() << "TCP server listening for HTTPS connections on" << DOMAIN_SERVER_HTTPS_PORT;
|
qDebug() << "TCP server listening for HTTPS connections on" << DOMAIN_SERVER_HTTPS_PORT;
|
||||||
|
|
||||||
} else if (!certPath.isEmpty() || !keyPath.isEmpty()) {
|
} else if (!certPath.isEmpty() || !keyPath.isEmpty()) {
|
||||||
qDebug() << "Missing certificate or private key. domain-server will now quit.";
|
static const QString MISSING_CERT_ERROR_MSG = "Missing certificate or private key. domain-server will now quit.";
|
||||||
QMetaObject::invokeMethod(this, "quit", Qt::QueuedConnection);
|
static const int MISSING_CERT_ERROR_CODE = 3;
|
||||||
|
|
||||||
|
QMetaObject::invokeMethod(this, "queuedQuit", Qt::QueuedConnection,
|
||||||
|
Q_ARG(QString, MISSING_CERT_ERROR_MSG), Q_ARG(int, MISSING_CERT_ERROR_CODE));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,8 +210,10 @@ bool DomainServer::optionallySetupOAuth() {
|
||||||
|| _hostname.isEmpty()
|
|| _hostname.isEmpty()
|
||||||
|| _oauthClientID.isEmpty()
|
|| _oauthClientID.isEmpty()
|
||||||
|| _oauthClientSecret.isEmpty()) {
|
|| _oauthClientSecret.isEmpty()) {
|
||||||
qDebug() << "Missing OAuth provider URL, hostname, client ID, or client secret. domain-server will now quit.";
|
static const QString MISSING_OAUTH_INFO_MSG = "Missing OAuth provider URL, hostname, client ID, or client secret. domain-server will now quit.";
|
||||||
QMetaObject::invokeMethod(this, "quit", Qt::QueuedConnection);
|
static const int MISSING_OAUTH_INFO_ERROR_CODE = 1542;
|
||||||
|
QMetaObject::invokeMethod(this, "queuedQuit", Qt::QueuedConnection,
|
||||||
|
Q_ARG(QString, MISSING_OAUTH_INFO_MSG), Q_ARG(int, MISSING_OAUTH_INFO_ERROR_CODE));
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "OAuth will be used to identify clients using provider at" << _oauthProviderURL.toString();
|
qDebug() << "OAuth will be used to identify clients using provider at" << _oauthProviderURL.toString();
|
||||||
|
@ -404,9 +417,13 @@ bool DomainServer::resetAccountManagerAccessToken() {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "Missing OAuth provider URL, but a domain-server feature was required that requires authentication." <<
|
static const QString MISSING_OAUTH_PROVIDER_MSG =
|
||||||
"domain-server will now quit.";
|
QString("Missing OAuth provider URL, but a domain-server feature was required that requires authentication.") +
|
||||||
QMetaObject::invokeMethod(this, "quit", Qt::QueuedConnection);
|
QString("domain-server will now quit.");
|
||||||
|
static const int MISSING_OAUTH_PROVIDER_ERROR_CODE = 5323;
|
||||||
|
QMetaObject::invokeMethod(this, "queuedQuit", Qt::QueuedConnection,
|
||||||
|
Q_ARG(QString, MISSING_OAUTH_PROVIDER_MSG),
|
||||||
|
Q_ARG(int, MISSING_OAUTH_PROVIDER_ERROR_CODE));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -517,11 +534,6 @@ void DomainServer::setupICEHeartbeatForFullNetworking() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DomainServer::loginFailed() {
|
|
||||||
qDebug() << "Login to data server has failed. domain-server will now quit";
|
|
||||||
QMetaObject::invokeMethod(this, "quit", Qt::QueuedConnection);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DomainServer::parseAssignmentConfigs(QSet<Assignment::Type>& excludedTypes) {
|
void DomainServer::parseAssignmentConfigs(QSet<Assignment::Type>& excludedTypes) {
|
||||||
// check for configs from the command line, these take precedence
|
// check for configs from the command line, these take precedence
|
||||||
const QString ASSIGNMENT_CONFIG_REGEX_STRING = "config-([\\d]+)";
|
const QString ASSIGNMENT_CONFIG_REGEX_STRING = "config-([\\d]+)";
|
||||||
|
|
|
@ -65,7 +65,6 @@ public slots:
|
||||||
private slots:
|
private slots:
|
||||||
void aboutToQuit();
|
void aboutToQuit();
|
||||||
|
|
||||||
void loginFailed();
|
|
||||||
void setupPendingAssignmentCredits();
|
void setupPendingAssignmentCredits();
|
||||||
void sendPendingTransactionsToServer();
|
void sendPendingTransactionsToServer();
|
||||||
|
|
||||||
|
@ -78,6 +77,8 @@ private slots:
|
||||||
void handleTempDomainSuccess(QNetworkReply& requestReply);
|
void handleTempDomainSuccess(QNetworkReply& requestReply);
|
||||||
void handleTempDomainError(QNetworkReply& requestReply);
|
void handleTempDomainError(QNetworkReply& requestReply);
|
||||||
|
|
||||||
|
void queuedQuit(QString quitMessage, int exitCode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupNodeListAndAssignments(const QUuid& sessionUUID = QUuid::createUuid());
|
void setupNodeListAndAssignments(const QUuid& sessionUUID = QUuid::createUuid());
|
||||||
bool optionallySetupOAuth();
|
bool optionallySetupOAuth();
|
||||||
|
|
|
@ -62,9 +62,14 @@ DomainServerSettingsManager::DomainServerSettingsManager() :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qCritical() << "Did not find settings decription in JSON at" << SETTINGS_DESCRIPTION_RELATIVE_PATH
|
static const QString MISSING_SETTINGS_DESC_MSG =
|
||||||
<< "- Unable to continue. domain-server will quit.";
|
QString("Did not find settings decription in JSON at %1 - Unable to continue. domain-server will quit.")
|
||||||
QMetaObject::invokeMethod(QCoreApplication::instance(), "quit", Qt::QueuedConnection);
|
.arg(SETTINGS_DESCRIPTION_RELATIVE_PATH);
|
||||||
|
static const int MISSING_SETTINGS_DESC_ERROR_CODE = 8912;
|
||||||
|
|
||||||
|
QMetaObject::invokeMethod(QCoreApplication::instance(), "queuedQuit", Qt::QueuedConnection,
|
||||||
|
Q_ARG(QString, MISSING_SETTINGS_DESC_MSG),
|
||||||
|
Q_ARG(int, MISSING_SETTINGS_DESC_ERROR_CODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DomainServerSettingsManager::processSettingsRequestPacket(QSharedPointer<ReceivedMessage> message) {
|
void DomainServerSettingsManager::processSettingsRequestPacket(QSharedPointer<ReceivedMessage> message) {
|
||||||
|
|
Loading…
Reference in a new issue