mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 19:01:09 +02:00
adding fix for getting DomainHandler into error state
This commit is contained in:
parent
e243792cac
commit
49f26d968a
2 changed files with 13 additions and 7 deletions
|
@ -55,6 +55,9 @@ DomainHandler::DomainHandler(QObject* parent) :
|
||||||
|
|
||||||
// stop the refresh timer if we connect to a domain
|
// stop the refresh timer if we connect to a domain
|
||||||
connect(this, &DomainHandler::connectedToDomain, &_apiRefreshTimer, &QTimer::stop);
|
connect(this, &DomainHandler::connectedToDomain, &_apiRefreshTimer, &QTimer::stop);
|
||||||
|
|
||||||
|
// stop the refresh timer if we connect to a domain
|
||||||
|
connect(this, &DomainHandler::redirectToErrorDomainURL, &_apiRefreshTimer, &QTimer::stop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DomainHandler::disconnect() {
|
void DomainHandler::disconnect() {
|
||||||
|
@ -99,7 +102,6 @@ void DomainHandler::softReset() {
|
||||||
|
|
||||||
clearSettings();
|
clearSettings();
|
||||||
|
|
||||||
_isInErrorState = false;
|
|
||||||
_connectionDenialsSinceKeypairRegen = 0;
|
_connectionDenialsSinceKeypairRegen = 0;
|
||||||
_checkInPacketsSinceLastReply = 0;
|
_checkInPacketsSinceLastReply = 0;
|
||||||
|
|
||||||
|
@ -107,11 +109,14 @@ void DomainHandler::softReset() {
|
||||||
QMetaObject::invokeMethod(&_settingsTimer, "stop");
|
QMetaObject::invokeMethod(&_settingsTimer, "stop");
|
||||||
|
|
||||||
// restart the API refresh timer in case we fail to connect and need to refresh information
|
// restart the API refresh timer in case we fail to connect and need to refresh information
|
||||||
QMetaObject::invokeMethod(&_apiRefreshTimer, "start");
|
if (!_isInErrorState)
|
||||||
|
QMetaObject::invokeMethod(&_apiRefreshTimer, "start");
|
||||||
|
_isInErrorState = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DomainHandler::hardReset() {
|
void DomainHandler::hardReset() {
|
||||||
emit resetting();
|
if (!_isInErrorState)
|
||||||
|
emit resetting();
|
||||||
|
|
||||||
softReset();
|
softReset();
|
||||||
|
|
||||||
|
@ -338,6 +343,7 @@ void DomainHandler::loadedErrorDomain(std::map<QString, QString> namedPaths) {
|
||||||
void DomainHandler::setRedirectErrorState(QUrl errorUrl, int reasonCode) {
|
void DomainHandler::setRedirectErrorState(QUrl errorUrl, int reasonCode) {
|
||||||
_errorDomainURL = errorUrl;
|
_errorDomainURL = errorUrl;
|
||||||
_lastDomainConnectionError = reasonCode;
|
_lastDomainConnectionError = reasonCode;
|
||||||
|
_isInErrorState = true;
|
||||||
emit redirectToErrorDomainURL(_errorDomainURL);
|
emit redirectToErrorDomainURL(_errorDomainURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,9 +486,8 @@ void DomainHandler::processDomainServerConnectionDeniedPacket(QSharedPointer<Rec
|
||||||
emit domainConnectionRefused(reasonMessage, (int)reasonCode, extraInfo);
|
emit domainConnectionRefused(reasonMessage, (int)reasonCode, extraInfo);
|
||||||
#else
|
#else
|
||||||
if (reasonCode == ConnectionRefusedReason::ProtocolMismatch || reasonCode == ConnectionRefusedReason::NotAuthorized) {
|
if (reasonCode == ConnectionRefusedReason::ProtocolMismatch || reasonCode == ConnectionRefusedReason::NotAuthorized) {
|
||||||
_isInErrorState = true;
|
|
||||||
// ingest the error - this is a "hard" connection refusal.
|
// ingest the error - this is a "hard" connection refusal.
|
||||||
emit redirectToErrorDomainURL(_errorDomainURL);
|
setRedirectErrorState(_errorDomainURL, (int)reasonCode);
|
||||||
} else {
|
} else {
|
||||||
emit domainConnectionRefused(reasonMessage, (int)reasonCode, extraInfo);
|
emit domainConnectionRefused(reasonMessage, (int)reasonCode, extraInfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,8 +87,6 @@ public:
|
||||||
void connectedToServerless(std::map<QString, QString> namedPaths);
|
void connectedToServerless(std::map<QString, QString> namedPaths);
|
||||||
|
|
||||||
void loadedErrorDomain(std::map<QString, QString> namedPaths);
|
void loadedErrorDomain(std::map<QString, QString> namedPaths);
|
||||||
// sets domain handler in error state.
|
|
||||||
void setRedirectErrorState(QUrl errorUrl, int reasonCode);
|
|
||||||
|
|
||||||
QString getViewPointFromNamedPath(QString namedPath);
|
QString getViewPointFromNamedPath(QString namedPath);
|
||||||
|
|
||||||
|
@ -172,6 +170,9 @@ public slots:
|
||||||
void processICEResponsePacket(QSharedPointer<ReceivedMessage> icePacket);
|
void processICEResponsePacket(QSharedPointer<ReceivedMessage> icePacket);
|
||||||
void processDomainServerConnectionDeniedPacket(QSharedPointer<ReceivedMessage> message);
|
void processDomainServerConnectionDeniedPacket(QSharedPointer<ReceivedMessage> message);
|
||||||
|
|
||||||
|
// sets domain handler in error state.
|
||||||
|
void setRedirectErrorState(QUrl errorUrl, int reasonCode);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void completedHostnameLookup(const QHostInfo& hostInfo);
|
void completedHostnameLookup(const QHostInfo& hostInfo);
|
||||||
void completedIceServerHostnameLookup();
|
void completedIceServerHostnameLookup();
|
||||||
|
|
Loading…
Reference in a new issue