2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

Try all available endpoints from config.

This commit is contained in:
John Preston
2018-05-02 22:07:34 +03:00
parent df4daca15b
commit 95fee543ec
7 changed files with 255 additions and 318 deletions

View File

@@ -415,7 +415,6 @@ ConnectionPrivate::ConnectionPrivate(
, _state(DisconnectedState)
, _shiftedDcId(shiftedDcId)
, _owner(owner)
, _configWasFineAt(getms(true))
, _retryTimer(thread, [=] { retryByTimer(); })
, _oldConnectionTimer(thread, [=] { markConnectionOld(); })
, _waitForConnectedTimer(thread, [=] { waitConnectedFailed(); })
@@ -1120,7 +1119,7 @@ void ConnectionPrivate::connectToServer(bool afterConfig) {
static_cast<Variants::Protocol>(protocol),
QString::fromStdString(endpoint.ip),
endpoint.port,
endpoint.protocolSecret);
endpoint.secret);
}
}
}
@@ -1142,7 +1141,9 @@ void ConnectionPrivate::connectToServer(bool afterConfig) {
return;
}
if (getms(true) - _configWasFineAt > kRequestConfigTimeout) {
if (!_startedConnectingAt) {
_startedConnectingAt = getms(true);
} else if (getms(true) - _startedConnectingAt > kRequestConfigTimeout) {
InvokeQueued(_instance, [instance = _instance] {
instance->requestConfigIfOld();
});
@@ -1549,6 +1550,7 @@ void ConnectionPrivate::handleReceived() {
DEBUG_LOG(("MTP Info: marked auth key as checked"));
sessionData->setCheckedKey(true);
}
_startedConnectingAt = TimeMs(0);
if (!wasConnected) {
if (getState() == ConnectedState) {
@@ -2456,8 +2458,6 @@ void ConnectionPrivate::updateAuthKey() {
QReadLocker lockFinished(&sessionDataMutex);
if (!sessionData || !_connection) return;
_configWasFineAt = getms(true);
DEBUG_LOG(("AuthKey Info: Connection updating key from Session, dc %1").arg(_shiftedDcId));
uint64 newKeyId = 0;
{