mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 22:39:18 +02:00
Merge branch 'protocol3' of https://github.com/howard-stearns/hifi into suggestions
This commit is contained in:
commit
98555be987
3 changed files with 21 additions and 5 deletions
|
@ -1083,9 +1083,11 @@ void DomainServer::sendHeartbeatToMetaverse(const QString& networkAddress) {
|
||||||
// Setup the domain object to send to the data server
|
// Setup the domain object to send to the data server
|
||||||
QJsonObject domainObject;
|
QJsonObject domainObject;
|
||||||
|
|
||||||
// add the version
|
// add the versions
|
||||||
static const QString VERSION_KEY = "version";
|
static const QString VERSION_KEY = "version";
|
||||||
domainObject[VERSION_KEY] = BuildInfo::VERSION;
|
domainObject[VERSION_KEY] = BuildInfo::VERSION;
|
||||||
|
static const QString PROTOCOL_KEY = "protocol";
|
||||||
|
domainObject[PROTOCOL_KEY] = protocolVersionsSignatureBase64();
|
||||||
|
|
||||||
// add networking
|
// add networking
|
||||||
if (!networkAddress.isEmpty()) {
|
if (!networkAddress.isEmpty()) {
|
||||||
|
@ -1119,7 +1121,12 @@ void DomainServer::sendHeartbeatToMetaverse(const QString& networkAddress) {
|
||||||
QString domainUpdateJSON = QString("{\"domain\":%1}").arg(QString(QJsonDocument(domainObject).toJson(QJsonDocument::Compact)));
|
QString domainUpdateJSON = QString("{\"domain\":%1}").arg(QString(QJsonDocument(domainObject).toJson(QJsonDocument::Compact)));
|
||||||
|
|
||||||
static const QString DOMAIN_UPDATE = "/api/v1/domains/%1";
|
static const QString DOMAIN_UPDATE = "/api/v1/domains/%1";
|
||||||
DependencyManager::get<AccountManager>()->sendRequest(DOMAIN_UPDATE.arg(uuidStringWithoutCurlyBraces(getID())),
|
QString path = DOMAIN_UPDATE.arg(uuidStringWithoutCurlyBraces(getID()));
|
||||||
|
#if DEV_BUILD || PR_BUILD
|
||||||
|
qDebug() << "Domain metadata sent to" << path;
|
||||||
|
qDebug() << "Domain metadata update:" << domainUpdateJSON;
|
||||||
|
#endif
|
||||||
|
DependencyManager::get<AccountManager>()->sendRequest(path,
|
||||||
AccountManagerAuth::Optional,
|
AccountManagerAuth::Optional,
|
||||||
QNetworkAccessManager::PutOperation,
|
QNetworkAccessManager::PutOperation,
|
||||||
JSONCallbackParameters(nullptr, QString(), this, "handleMetaverseHeartbeatError"),
|
JSONCallbackParameters(nullptr, QString(), this, "handleMetaverseHeartbeatError"),
|
||||||
|
|
|
@ -99,8 +99,9 @@ void sendWrongProtocolVersionsSignature(bool sendWrongVersion) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QByteArray protocolVersionsSignature() {
|
static QByteArray protocolVersionSignature;
|
||||||
static QByteArray protocolVersionSignature;
|
static QString protocolVersionSignatureBase64;
|
||||||
|
static void ensureProtocolVersionsSignature() {
|
||||||
static std::once_flag once;
|
static std::once_flag once;
|
||||||
std::call_once(once, [&] {
|
std::call_once(once, [&] {
|
||||||
QByteArray buffer;
|
QByteArray buffer;
|
||||||
|
@ -114,8 +115,11 @@ QByteArray protocolVersionsSignature() {
|
||||||
QCryptographicHash hash(QCryptographicHash::Md5);
|
QCryptographicHash hash(QCryptographicHash::Md5);
|
||||||
hash.addData(buffer);
|
hash.addData(buffer);
|
||||||
protocolVersionSignature = hash.result();
|
protocolVersionSignature = hash.result();
|
||||||
|
protocolVersionSignatureBase64 = protocolVersionSignature.toBase64();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
QByteArray protocolVersionsSignature() {
|
||||||
|
ensureProtocolVersionsSignature();
|
||||||
#if (PR_BUILD || DEV_BUILD)
|
#if (PR_BUILD || DEV_BUILD)
|
||||||
if (sendWrongProtocolVersion) {
|
if (sendWrongProtocolVersion) {
|
||||||
return QByteArray("INCORRECTVERSION"); // only for debugging version checking
|
return QByteArray("INCORRECTVERSION"); // only for debugging version checking
|
||||||
|
@ -124,3 +128,7 @@ QByteArray protocolVersionsSignature() {
|
||||||
|
|
||||||
return protocolVersionSignature;
|
return protocolVersionSignature;
|
||||||
}
|
}
|
||||||
|
QString protocolVersionsSignatureBase64() {
|
||||||
|
ensureProtocolVersionsSignature();
|
||||||
|
return protocolVersionSignatureBase64;
|
||||||
|
}
|
||||||
|
|
|
@ -113,6 +113,7 @@ extern const QSet<PacketType> NON_SOURCED_PACKETS;
|
||||||
|
|
||||||
PacketVersion versionForPacketType(PacketType packetType);
|
PacketVersion versionForPacketType(PacketType packetType);
|
||||||
QByteArray protocolVersionsSignature(); /// returns a unqiue signature for all the current protocols
|
QByteArray protocolVersionsSignature(); /// returns a unqiue signature for all the current protocols
|
||||||
|
QString protocolVersionsSignatureBase64();
|
||||||
|
|
||||||
#if (PR_BUILD || DEV_BUILD)
|
#if (PR_BUILD || DEV_BUILD)
|
||||||
void sendWrongProtocolVersionsSignature(bool sendWrongVersion); /// for debugging version negotiation
|
void sendWrongProtocolVersionsSignature(bool sendWrongVersion); /// for debugging version negotiation
|
||||||
|
|
Loading…
Reference in a new issue