mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 12:10:44 +02:00
Merge pull request #5222 from birarda/ac-failover
add a forced failover for hanging STUN dns lookup
This commit is contained in:
commit
8ee0bd24fe
3 changed files with 27 additions and 13 deletions
|
@ -743,6 +743,14 @@ void LimitedNodeList::startSTUNPublicSocketUpdate() {
|
|||
// if we don't know the STUN IP yet we need to have ourselves be called once it is known
|
||||
if (_stunSockAddr.getAddress().isNull()) {
|
||||
connect(&_stunSockAddr, &HifiSockAddr::lookupCompleted, this, &LimitedNodeList::startSTUNPublicSocketUpdate);
|
||||
|
||||
// in case we just completely fail to lookup the stun socket - add a 10s timeout that will trigger the fail case
|
||||
const quint64 STUN_DNS_LOOKUP_TIMEOUT_MSECS = 10 * 1000;
|
||||
|
||||
QTimer* stunLookupFailTimer = new QTimer(this);
|
||||
connect(stunLookupFailTimer, &QTimer::timeout, this, &LimitedNodeList::possiblyTimeoutSTUNAddressLookup);
|
||||
stunLookupFailTimer->start(STUN_DNS_LOOKUP_TIMEOUT_MSECS);
|
||||
|
||||
} else {
|
||||
// setup our initial STUN timer here so we can quickly find out our public IP address
|
||||
_initialSTUNTimer = new QTimer(this);
|
||||
|
@ -758,6 +766,13 @@ void LimitedNodeList::startSTUNPublicSocketUpdate() {
|
|||
}
|
||||
}
|
||||
|
||||
void LimitedNodeList::possiblyTimeoutSTUNAddressLookup() {
|
||||
if (_stunSockAddr.getAddress().isNull()) {
|
||||
// our stun address is still NULL, but we've been waiting for long enough - time to force a fail
|
||||
stopInitialSTUNUpdate(false);
|
||||
}
|
||||
}
|
||||
|
||||
void LimitedNodeList::stopInitialSTUNUpdate(bool success) {
|
||||
_hasCompletedInitialSTUN = true;
|
||||
|
||||
|
@ -777,8 +792,6 @@ void LimitedNodeList::stopInitialSTUNUpdate(bool success) {
|
|||
flagTimeForConnectionStep(ConnectionStep::SetPublicSocketFromSTUN);
|
||||
}
|
||||
|
||||
assert(_initialSTUNTimer);
|
||||
|
||||
// stop our initial fast timer
|
||||
if (_initialSTUNTimer) {
|
||||
_initialSTUNTimer->stop();
|
||||
|
|
|
@ -317,6 +317,7 @@ protected:
|
|||
}
|
||||
private slots:
|
||||
void flagTimeForConnectionStep(ConnectionStep connectionStep, quint64 timestamp);
|
||||
void possiblyTimeoutSTUNAddressLookup();
|
||||
};
|
||||
|
||||
#endif // hifi_LimitedNodeList_h
|
||||
|
|
Loading…
Reference in a new issue