History

only re-request ice addresses during failure

Stephen Birarda committed 10 years ago

Commit 84df6cf1 parent 9bca2302 files · +10 −15Browse files

Showing the changes to domain-server/src/DomainServer.cpp (1 of 2 files). Show all

Unified · Split

domain-server/src/DomainServer.cpp+9−13
@@ -489,15 +489,6 @@ void DomainServer::setupICEHeartbeatForFullNetworking() { · 488 unmodified lines
489489 // lookup the available ice-server hosts now
490490 updateICEServerAddresses();
491491
492− const int ICE_ADDRESS_UPDATE_MSECS = 30 * 1000;
493−
494− // hookup a timer to keep those updated every ICE_ADDRESS_UPDATE_MSECS in case of a failure requiring a switchover
495− if (_iceAddressLookupTimer) {
496− _iceAddressLookupTimer = new QTimer { this };
497− connect(_iceAddressLookupTimer, &QTimer::timeout, this, &DomainServer::updateICEServerAddresses);
498− _iceAddressLookupTimer->start(ICE_ADDRESS_UPDATE_MSECS);
499− }
500−
501492 // call our sendHeartbeatToIceServer immediately anytime a local or public socket changes
502493 connect(limitedNodeList.data(), &LimitedNodeList::localSockAddrChanged,
503494 this, &DomainServer::sendHeartbeatToIceServer);
@@ -1170,7 +1161,8 @@ void DomainServer::sendHeartbeatToIceServer() { · 666 unmodified lines
11701161 // reset the connection flag for ICE server
11711162 _connectedToICEServer = false;
11721163
1173− randomizeICEServerAddress();
1164+ // randomize our ice-server address (and simultaneously look up any new hostnames for available ice-servers)
1165+ randomizeICEServerAddress(true);
11741166 }
11751167
11761168 // 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) { · 987 unmodified lines
21642156 }
21652157
21662158 if (_iceServerSocket.isNull()) {
2167− // we don't have a candidate ice-server yet, pick now
2168− randomizeICEServerAddress();
2159+ // we don't have a candidate ice-server yet, pick now (without triggering a host lookup since we just did one)
2160+ randomizeICEServerAddress(false);
21692161 }
21702162 }
21712163 }
21722164
2173−void DomainServer::randomizeICEServerAddress() {
2165+void DomainServer::randomizeICEServerAddress(bool shouldTriggerHostLookup) {
2166+ if (shouldTriggerHostLookup) {
2167+ updateICEServerAddresses();
2168+ }
2169+
21742170 // create a list by removing the already failed ice-server addresses
21752171 auto candidateICEAddresses = _iceServerAddresses;
21762172

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t