tell metaverse ice-server is 0.0.0.0 when domain-server doesn't have one

This commit is contained in:
Seth Alves 2016-09-21 10:07:12 -07:00
parent 6bce73db80
commit a3aea774fe

View file

@ -1271,13 +1271,16 @@ void DomainServer::handleMetaverseHeartbeatError(QNetworkReply& requestReply) {
} }
void DomainServer::sendICEServerAddressToMetaverseAPI() { void DomainServer::sendICEServerAddressToMetaverseAPI() {
if (!_iceServerSocket.isNull()) {
const QString ICE_SERVER_ADDRESS = "ice_server_address"; const QString ICE_SERVER_ADDRESS = "ice_server_address";
QJsonObject domainObject; QJsonObject domainObject;
if (!_connectedToICEServer || _iceServerSocket.isNull()) {
domainObject[ICE_SERVER_ADDRESS] = "0.0.0.0";
} else {
// we're using full automatic networking and we have a current ice-server socket, use that now // we're using full automatic networking and we have a current ice-server socket, use that now
domainObject[ICE_SERVER_ADDRESS] = _iceServerSocket.getAddress().toString(); domainObject[ICE_SERVER_ADDRESS] = _iceServerSocket.getAddress().toString();
}
const auto& temporaryDomainKey = DependencyManager::get<AccountManager>()->getTemporaryDomainKey(getID()); const auto& temporaryDomainKey = DependencyManager::get<AccountManager>()->getTemporaryDomainKey(getID());
if (!temporaryDomainKey.isEmpty()) { if (!temporaryDomainKey.isEmpty()) {
@ -1296,7 +1299,7 @@ void DomainServer::sendICEServerAddressToMetaverseAPI() {
static QString repeatedMessage = LogHandler::getInstance().addOnlyOnceMessageRegex static QString repeatedMessage = LogHandler::getInstance().addOnlyOnceMessageRegex
("Updating ice-server address in High Fidelity Metaverse API to [^ \n]+"); ("Updating ice-server address in High Fidelity Metaverse API to [^ \n]+");
qDebug() << "Updating ice-server address in High Fidelity Metaverse API to" qDebug() << "Updating ice-server address in High Fidelity Metaverse API to"
<< _iceServerSocket.getAddress().toString(); << (_iceServerSocket.isNull() ? "" : _iceServerSocket.getAddress().toString());
static const QString DOMAIN_ICE_ADDRESS_UPDATE = "/api/v1/domains/%1/ice_server_address"; static const QString DOMAIN_ICE_ADDRESS_UPDATE = "/api/v1/domains/%1/ice_server_address";
@ -1305,7 +1308,6 @@ void DomainServer::sendICEServerAddressToMetaverseAPI() {
QNetworkAccessManager::PutOperation, QNetworkAccessManager::PutOperation,
callbackParameters, callbackParameters,
domainUpdateJSON.toUtf8()); domainUpdateJSON.toUtf8());
}
} }
void DomainServer::handleFailedICEServerAddressUpdate(QNetworkReply& requestReply) { void DomainServer::handleFailedICEServerAddressUpdate(QNetworkReply& requestReply) {
@ -1357,6 +1359,7 @@ void DomainServer::sendHeartbeatToIceServer() {
// reset the connection flag for ICE server // reset the connection flag for ICE server
_connectedToICEServer = false; _connectedToICEServer = false;
sendICEServerAddressToMetaverseAPI();
// randomize our ice-server address (and simultaneously look up any new hostnames for available ice-servers) // randomize our ice-server address (and simultaneously look up any new hostnames for available ice-servers)
randomizeICEServerAddress(true); randomizeICEServerAddress(true);
@ -2329,6 +2332,7 @@ void DomainServer::processICEServerHeartbeatACK(QSharedPointer<ReceivedMessage>
if (!_connectedToICEServer) { if (!_connectedToICEServer) {
_connectedToICEServer = true; _connectedToICEServer = true;
sendICEServerAddressToMetaverseAPI();
qInfo() << "Connected to ice-server at" << _iceServerSocket; qInfo() << "Connected to ice-server at" << _iceServerSocket;
} }
} }