mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-24 01:24:00 +02:00
Merge pull request #7668 from birarda/ice-server-redundancy
reduce ice.highfidelity.com DNS queries when not failing
This commit is contained in:
commit
50c8b5858e
2 changed files with 10 additions and 15 deletions
|
@ -489,15 +489,6 @@ void DomainServer::setupICEHeartbeatForFullNetworking() {
|
||||||
// lookup the available ice-server hosts now
|
// lookup the available ice-server hosts now
|
||||||
updateICEServerAddresses();
|
updateICEServerAddresses();
|
||||||
|
|
||||||
const int ICE_ADDRESS_UPDATE_MSECS = 30 * 1000;
|
|
||||||
|
|
||||||
// hookup a timer to keep those updated every ICE_ADDRESS_UPDATE_MSECS in case of a failure requiring a switchover
|
|
||||||
if (_iceAddressLookupTimer) {
|
|
||||||
_iceAddressLookupTimer = new QTimer { this };
|
|
||||||
connect(_iceAddressLookupTimer, &QTimer::timeout, this, &DomainServer::updateICEServerAddresses);
|
|
||||||
_iceAddressLookupTimer->start(ICE_ADDRESS_UPDATE_MSECS);
|
|
||||||
}
|
|
||||||
|
|
||||||
// call our sendHeartbeatToIceServer immediately anytime a local or public socket changes
|
// call our sendHeartbeatToIceServer immediately anytime a local or public socket changes
|
||||||
connect(limitedNodeList.data(), &LimitedNodeList::localSockAddrChanged,
|
connect(limitedNodeList.data(), &LimitedNodeList::localSockAddrChanged,
|
||||||
this, &DomainServer::sendHeartbeatToIceServer);
|
this, &DomainServer::sendHeartbeatToIceServer);
|
||||||
|
@ -1170,7 +1161,8 @@ void DomainServer::sendHeartbeatToIceServer() {
|
||||||
// reset the connection flag for ICE server
|
// reset the connection flag for ICE server
|
||||||
_connectedToICEServer = false;
|
_connectedToICEServer = false;
|
||||||
|
|
||||||
randomizeICEServerAddress();
|
// randomize our ice-server address (and simultaneously look up any new hostnames for available ice-servers)
|
||||||
|
randomizeICEServerAddress(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: I'd love to specify the correct size for the packet here, but it's a little trickey with
|
// NOTE: I'd love to specify the correct size for the packet here, but it's a little trickey with
|
||||||
|
@ -2164,13 +2156,17 @@ void DomainServer::handleICEHostInfo(const QHostInfo& hostInfo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_iceServerSocket.isNull()) {
|
if (_iceServerSocket.isNull()) {
|
||||||
// we don't have a candidate ice-server yet, pick now
|
// we don't have a candidate ice-server yet, pick now (without triggering a host lookup since we just did one)
|
||||||
randomizeICEServerAddress();
|
randomizeICEServerAddress(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DomainServer::randomizeICEServerAddress() {
|
void DomainServer::randomizeICEServerAddress(bool shouldTriggerHostLookup) {
|
||||||
|
if (shouldTriggerHostLookup) {
|
||||||
|
updateICEServerAddresses();
|
||||||
|
}
|
||||||
|
|
||||||
// create a list by removing the already failed ice-server addresses
|
// create a list by removing the already failed ice-server addresses
|
||||||
auto candidateICEAddresses = _iceServerAddresses;
|
auto candidateICEAddresses = _iceServerAddresses;
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ private:
|
||||||
void setupICEHeartbeatForFullNetworking();
|
void setupICEHeartbeatForFullNetworking();
|
||||||
void sendHeartbeatToDataServer(const QString& networkAddress);
|
void sendHeartbeatToDataServer(const QString& networkAddress);
|
||||||
|
|
||||||
void randomizeICEServerAddress();
|
void randomizeICEServerAddress(bool shouldTriggerHostLookup);
|
||||||
|
|
||||||
unsigned int countConnectedUsers();
|
unsigned int countConnectedUsers();
|
||||||
|
|
||||||
|
@ -172,7 +172,6 @@ private:
|
||||||
|
|
||||||
QList<QHostAddress> _iceServerAddresses;
|
QList<QHostAddress> _iceServerAddresses;
|
||||||
QSet<QHostAddress> _failedIceServerAddresses;
|
QSet<QHostAddress> _failedIceServerAddresses;
|
||||||
QTimer* _iceAddressLookupTimer { nullptr }; // this looks like a dangling pointer but is parented to the DomainServer
|
|
||||||
int _iceAddressLookupID { -1 };
|
int _iceAddressLookupID { -1 };
|
||||||
int _noReplyICEHeartbeats { 0 };
|
int _noReplyICEHeartbeats { 0 };
|
||||||
int _numHeartbeatDenials { 0 };
|
int _numHeartbeatDenials { 0 };
|
||||||
|
|
Loading…
Reference in a new issue