mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 15:17:42 +02:00
Merge branch '404DomainRedirect' of https://github.com/wayne-chen/hifi into 404DomainRedirect
This commit is contained in:
commit
e3f5f4c55a
5 changed files with 29 additions and 29 deletions
|
@ -1197,11 +1197,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
getOverlays().deleteOverlay(getTabletHomeButtonID());
|
getOverlays().deleteOverlay(getTabletHomeButtonID());
|
||||||
getOverlays().deleteOverlay(getTabletFrameID());
|
getOverlays().deleteOverlay(getTabletFrameID());
|
||||||
});
|
});
|
||||||
#if defined(Q_OS_ANDROID)
|
|
||||||
connect(&domainHandler, &DomainHandler::domainConnectionRefused, this, &Application::domainConnectionRefused);
|
connect(&domainHandler, &DomainHandler::domainConnectionRefused, this, &Application::domainConnectionRefused);
|
||||||
#else
|
|
||||||
connect(&domainHandler, &DomainHandler::domainConnectionRefused, this, &Application::domainConnectionRedirect);
|
&domainHandler.setErrorDomainURL(QUrl(REDIRECT_HIFI_ADDRESS));
|
||||||
#endif
|
|
||||||
|
|
||||||
// We could clear ATP assets only when changing domains, but it's possible that the domain you are connected
|
// We could clear ATP assets only when changing domains, but it's possible that the domain you are connected
|
||||||
// to has gone down and switched to a new content set, so when you reconnect the cached ATP assets will no longer be valid.
|
// to has gone down and switched to a new content set, so when you reconnect the cached ATP assets will no longer be valid.
|
||||||
|
@ -2345,31 +2343,11 @@ void Application::domainConnectionRefused(const QString& reasonMessage, int reas
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::domainConnectionRedirect(const QString& reasonMessage, int reasonCodeInt, const QString& extraInfo) {
|
void Application::domainConnectionRedirect() {
|
||||||
DomainHandler::ConnectionRefusedReason reasonCode = static_cast<DomainHandler::ConnectionRefusedReason>(reasonCodeInt);
|
|
||||||
auto addressManager = DependencyManager::get<AddressManager>();
|
auto addressManager = DependencyManager::get<AddressManager>();
|
||||||
|
|
||||||
if (reasonCode == DomainHandler::ConnectionRefusedReason::TooManyUsers && !extraInfo.isEmpty()) {
|
addressManager->handleLookupString(REDIRECT_HIFI_ADDRESS);
|
||||||
addressManager->handleLookupString(extraInfo);
|
getMyAvatar()->setWorldVelocity(glm::vec3(0.0f));
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (reasonCode) {
|
|
||||||
case DomainHandler::ConnectionRefusedReason::ProtocolMismatch:
|
|
||||||
case DomainHandler::ConnectionRefusedReason::TooManyUsers:
|
|
||||||
case DomainHandler::ConnectionRefusedReason::Unknown: {
|
|
||||||
QString message = "Unable to connect to the location you are visiting.\n";
|
|
||||||
message += reasonMessage;
|
|
||||||
//OffscreenUi::asyncWarning("", message);
|
|
||||||
addressManager->handleLookupString(REDIRECT_HIFI_ADDRESS);
|
|
||||||
getMyAvatar()->setWorldVelocity(glm::vec3(0.0f));
|
|
||||||
// in (w, x, y, z) component-structure for the constructor
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
// nothing to do.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -474,7 +474,7 @@ private slots:
|
||||||
void updateDisplayMode();
|
void updateDisplayMode();
|
||||||
void setDisplayPlugin(DisplayPluginPointer newPlugin);
|
void setDisplayPlugin(DisplayPluginPointer newPlugin);
|
||||||
void domainConnectionRefused(const QString& reasonMessage, int reason, const QString& extraInfo);
|
void domainConnectionRefused(const QString& reasonMessage, int reason, const QString& extraInfo);
|
||||||
void domainConnectionRedirect(const QString& reasonMessage, int reason, const QString& extraInfo);
|
void domainConnectionRedirect();
|
||||||
|
|
||||||
void addAssetToWorldCheckModelSize();
|
void addAssetToWorldCheckModelSize();
|
||||||
|
|
||||||
|
|
|
@ -319,7 +319,9 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl, LookupTrigger trigger) {
|
||||||
// lookupUrl.scheme() == URL_SCHEME_HTTPS ||
|
// lookupUrl.scheme() == URL_SCHEME_HTTPS ||
|
||||||
_previousLookup.clear();
|
_previousLookup.clear();
|
||||||
_shareablePlaceName.clear();
|
_shareablePlaceName.clear();
|
||||||
setDomainInfo(lookupUrl, trigger);
|
if (lookupUrl.toString() != REDIRECT_HIFI_ADDRESS) {
|
||||||
|
setDomainInfo(lookupUrl, trigger);
|
||||||
|
}
|
||||||
emit lookupResultsFinished();
|
emit lookupResultsFinished();
|
||||||
|
|
||||||
QString path = DOMAIN_SPAWNING_POINT;
|
QString path = DOMAIN_SPAWNING_POINT;
|
||||||
|
|
|
@ -128,6 +128,10 @@ void DomainHandler::hardReset() {
|
||||||
_pendingPath.clear();
|
_pendingPath.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DomainHandler::setErrorDomainURL(const QUrl& url) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void DomainHandler::setSockAddr(const HifiSockAddr& sockAddr, const QString& hostname) {
|
void DomainHandler::setSockAddr(const HifiSockAddr& sockAddr, const QString& hostname) {
|
||||||
if (_sockAddr != sockAddr) {
|
if (_sockAddr != sockAddr) {
|
||||||
// we should reset on a sockAddr change
|
// we should reset on a sockAddr change
|
||||||
|
@ -451,7 +455,17 @@ void DomainHandler::processDomainServerConnectionDeniedPacket(QSharedPointer<Rec
|
||||||
|
|
||||||
if (!_domainConnectionRefusals.contains(reasonMessage)) {
|
if (!_domainConnectionRefusals.contains(reasonMessage)) {
|
||||||
_domainConnectionRefusals.insert(reasonMessage);
|
_domainConnectionRefusals.insert(reasonMessage);
|
||||||
|
#if defined(Q_OS_ANDROID)
|
||||||
emit domainConnectionRefused(reasonMessage, (int)reasonCode, extraInfo);
|
emit domainConnectionRefused(reasonMessage, (int)reasonCode, extraInfo);
|
||||||
|
#else
|
||||||
|
if (reasonCode == ConnectionRefusedReason::ProtocolMismatch || reasonCode == ConnectionRefusedReason::NotAuthorized) {
|
||||||
|
_isInErrorState = true;
|
||||||
|
// ingest the error - this is a "hard" connection refusal.
|
||||||
|
emit domainURLChanged(_errorDomainURL);
|
||||||
|
} else {
|
||||||
|
emit domainConnectionRefused(reasonMessage, (int)reasonCode, extraInfo);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
auto accountManager = DependencyManager::get<AccountManager>();
|
auto accountManager = DependencyManager::get<AccountManager>();
|
||||||
|
|
|
@ -50,6 +50,9 @@ public:
|
||||||
|
|
||||||
QString getHostname() const { return _domainURL.host(); }
|
QString getHostname() const { return _domainURL.host(); }
|
||||||
|
|
||||||
|
QUrl getErrorDomainURL(){ return _errorDomainURL; }
|
||||||
|
void setErrorDomainURL(const QUrl& url);
|
||||||
|
|
||||||
const QHostAddress& getIP() const { return _sockAddr.getAddress(); }
|
const QHostAddress& getIP() const { return _sockAddr.getAddress(); }
|
||||||
void setIPToLocalhost() { _sockAddr.setAddress(QHostAddress(QHostAddress::LocalHost)); }
|
void setIPToLocalhost() { _sockAddr.setAddress(QHostAddress(QHostAddress::LocalHost)); }
|
||||||
|
|
||||||
|
@ -179,6 +182,7 @@ signals:
|
||||||
void settingsReceiveFail();
|
void settingsReceiveFail();
|
||||||
|
|
||||||
void domainConnectionRefused(QString reasonMessage, int reason, const QString& extraInfo);
|
void domainConnectionRefused(QString reasonMessage, int reason, const QString& extraInfo);
|
||||||
|
void redirectToErrorDomainURL();
|
||||||
|
|
||||||
void limitOfSilentDomainCheckInsReached();
|
void limitOfSilentDomainCheckInsReached();
|
||||||
|
|
||||||
|
@ -190,6 +194,7 @@ private:
|
||||||
QUuid _uuid;
|
QUuid _uuid;
|
||||||
Node::LocalID _localID;
|
Node::LocalID _localID;
|
||||||
QUrl _domainURL;
|
QUrl _domainURL;
|
||||||
|
QUrl _errorDomainURL;
|
||||||
HifiSockAddr _sockAddr;
|
HifiSockAddr _sockAddr;
|
||||||
QUuid _assignmentUUID;
|
QUuid _assignmentUUID;
|
||||||
QUuid _connectionToken;
|
QUuid _connectionToken;
|
||||||
|
@ -198,6 +203,7 @@ private:
|
||||||
HifiSockAddr _iceServerSockAddr;
|
HifiSockAddr _iceServerSockAddr;
|
||||||
NetworkPeer _icePeer;
|
NetworkPeer _icePeer;
|
||||||
bool _isConnected { false };
|
bool _isConnected { false };
|
||||||
|
bool _isInErrorState { false };
|
||||||
QJsonObject _settingsObject;
|
QJsonObject _settingsObject;
|
||||||
QString _pendingPath;
|
QString _pendingPath;
|
||||||
QTimer _settingsTimer;
|
QTimer _settingsTimer;
|
||||||
|
|
Loading…
Reference in a new issue