mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-17 04:37:43 +02:00
Merge pull request #11244 from birarda/bug/ice-dns-fail
add a timeout for ICE server DNS lookup
This commit is contained in:
commit
7cce45017b
2 changed files with 26 additions and 2 deletions
|
@ -752,8 +752,28 @@ void DomainServer::setupICEHeartbeatForFullNetworking() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DomainServer::updateICEServerAddresses() {
|
void DomainServer::updateICEServerAddresses() {
|
||||||
if (_iceAddressLookupID == -1) {
|
if (_iceAddressLookupID == INVALID_ICE_LOOKUP_ID) {
|
||||||
_iceAddressLookupID = QHostInfo::lookupHost(_iceServerAddr, this, SLOT(handleICEHostInfo(QHostInfo)));
|
_iceAddressLookupID = QHostInfo::lookupHost(_iceServerAddr, this, SLOT(handleICEHostInfo(QHostInfo)));
|
||||||
|
|
||||||
|
// there seems to be a 5.9 bug where lookupHost never calls our slot
|
||||||
|
// so we add a single shot manual "timeout" to fire it off again if it hasn't called back yet
|
||||||
|
static const int ICE_ADDRESS_LOOKUP_TIMEOUT_MS = 5000;
|
||||||
|
QTimer::singleShot(ICE_ADDRESS_LOOKUP_TIMEOUT_MS, this, &DomainServer::timeoutICEAddressLookup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DomainServer::timeoutICEAddressLookup() {
|
||||||
|
if (_iceAddressLookupID != INVALID_ICE_LOOKUP_ID) {
|
||||||
|
// we waited 5s and didn't hear back for our ICE DNS lookup
|
||||||
|
// so time that one out and kick off another
|
||||||
|
|
||||||
|
qDebug() << "IP address lookup timed out for" << _iceServerAddr << "- retrying";
|
||||||
|
|
||||||
|
QHostInfo::abortHostLookup(_iceAddressLookupID);
|
||||||
|
|
||||||
|
_iceAddressLookupID = INVALID_ICE_LOOKUP_ID;
|
||||||
|
|
||||||
|
updateICEServerAddresses();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,8 @@ typedef QMultiHash<QUuid, WalletTransaction*> TransactionHash;
|
||||||
using Subnet = QPair<QHostAddress, int>;
|
using Subnet = QPair<QHostAddress, int>;
|
||||||
using SubnetList = std::vector<Subnet>;
|
using SubnetList = std::vector<Subnet>;
|
||||||
|
|
||||||
|
const int INVALID_ICE_LOOKUP_ID = -1;
|
||||||
|
|
||||||
enum ReplicationServerDirection {
|
enum ReplicationServerDirection {
|
||||||
Upstream,
|
Upstream,
|
||||||
Downstream
|
Downstream
|
||||||
|
@ -114,6 +116,8 @@ private slots:
|
||||||
void tokenGrantFinished();
|
void tokenGrantFinished();
|
||||||
void profileRequestFinished();
|
void profileRequestFinished();
|
||||||
|
|
||||||
|
void timeoutICEAddressLookup();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void iceServerChanged();
|
void iceServerChanged();
|
||||||
void userConnected();
|
void userConnected();
|
||||||
|
@ -223,7 +227,7 @@ private:
|
||||||
|
|
||||||
QList<QHostAddress> _iceServerAddresses;
|
QList<QHostAddress> _iceServerAddresses;
|
||||||
QSet<QHostAddress> _failedIceServerAddresses;
|
QSet<QHostAddress> _failedIceServerAddresses;
|
||||||
int _iceAddressLookupID { -1 };
|
int _iceAddressLookupID { INVALID_ICE_LOOKUP_ID };
|
||||||
int _noReplyICEHeartbeats { 0 };
|
int _noReplyICEHeartbeats { 0 };
|
||||||
int _numHeartbeatDenials { 0 };
|
int _numHeartbeatDenials { 0 };
|
||||||
bool _connectedToICEServer { false };
|
bool _connectedToICEServer { false };
|
||||||
|
|
Loading…
Reference in a new issue