Showing the changes to domain-server/src/DomainServer.cpp (1 of 2 files). Show all
Unified · Split
| @@ -489,15 +489,6 @@ void DomainServer::setupICEHeartbeatForFullNetworking() { · 488 unmodified lines | |||
| 489 | // lookup the available ice-server hosts now | 489 | // 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 changes | 492 | // 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 server | 1161 | // 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 with | 1168 | // 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 now | 2159 | // 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 | ||
| 2173 | void DomainServer::randomizeICEServerAddress() { | 2165 | void DomainServer::randomizeICEServerAddress(bool shouldTriggerHostLookup) { |
| 2166 | if (shouldTriggerHostLookup) { | ||
| 2167 | updateICEServerAddresses(); | ||
| 2168 | } | ||
| 2169 | |||
| 2174 | // create a list by removing the already failed ice-server addresses | 2170 | // create a list by removing the already failed ice-server addresses |
| 2175 | auto candidateICEAddresses = _iceServerAddresses; | 2171 | auto candidateICEAddresses = _iceServerAddresses; |
| 2176 | 2172 | ||