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
489 // lookup the available ice-server hosts now489 // lookup the available ice-server hosts now
490 updateICEServerAddresses();490 updateICEServerAddresses();
491 491
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
501 // call our sendHeartbeatToIceServer immediately anytime a local or public socket changes492 // call our sendHeartbeatToIceServer immediately anytime a local or public socket changes
502 connect(limitedNodeList.data(), &LimitedNodeList::localSockAddrChanged,493 connect(limitedNodeList.data(), &LimitedNodeList::localSockAddrChanged,
503 this, &DomainServer::sendHeartbeatToIceServer);494 this, &DomainServer::sendHeartbeatToIceServer);
@@ -1170,7 +1161,8 @@ void DomainServer::sendHeartbeatToIceServer() { · 666 unmodified lines
1170 // reset the connection flag for ICE server1161 // reset the connection flag for ICE server
1171 _connectedToICEServer = false;1162 _connectedToICEServer = false;
1172 1163
1173 randomizeICEServerAddress();1164 // randomize our ice-server address (and simultaneously look up any new hostnames for available ice-servers)
1165 randomizeICEServerAddress(true);
1174 }1166 }
1175 1167
1176 // NOTE: I'd love to specify the correct size for the packet here, but it's a little trickey with1168 // 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
2164 }2156 }
2165 2157
2166 if (_iceServerSocket.isNull()) {2158 if (_iceServerSocket.isNull()) {
2167 // we don't have a candidate ice-server yet, pick now2159 // we don't have a candidate ice-server yet, pick now (without triggering a host lookup since we just did one)
2168 randomizeICEServerAddress();2160 randomizeICEServerAddress(false);
2169 }2161 }
2170 }2162 }
2171}2163}
2172 2164
2173void DomainServer::randomizeICEServerAddress() {2165void DomainServer::randomizeICEServerAddress(bool shouldTriggerHostLookup) {
2166 if (shouldTriggerHostLookup) {
2167 updateICEServerAddresses();
2168 }
2169
2174 // create a list by removing the already failed ice-server addresses2170 // create a list by removing the already failed ice-server addresses
2175 auto candidateICEAddresses = _iceServerAddresses;2171 auto candidateICEAddresses = _iceServerAddresses;
2176 2172

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