aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorArseny Smirnov <arseny30@gmail.com>2020-01-08 15:54:42 +0000
committerArseny Smirnov <arseny30@gmail.com>2020-01-08 15:54:42 +0000
commitefc483551f1a166ea7c07d0c9fa7d5c5a058587b (patch)
tree307141354b834aaf97cd5a7401926784ac2ac94d
parent4922ae62e09cd01dbf4e0b40f2d4ab7ce78031e9 (diff)
Bugfixes in auth key validation
GitOrigin-RevId: 66c2002e3ccb48c333c580715dc3517665f57b1f
-rw-r--r--td/telegram/net/DcAuthManager.cpp4
-rw-r--r--td/telegram/net/Session.cpp3
2 files changed, 7 insertions, 0 deletions
diff --git a/td/telegram/net/DcAuthManager.cpp b/td/telegram/net/DcAuthManager.cpp
index 917fb5363..85fd52b62 100644
--- a/td/telegram/net/DcAuthManager.cpp
+++ b/td/telegram/net/DcAuthManager.cpp
@@ -157,6 +157,10 @@ void DcAuthManager::dc_loop(DcInfo &dc) {
if (dc.auth_key_state == AuthKeyState::OK) {
return;
}
+ if (dc.state == DcInfo::State::Ok) {
+ LOG(WARNING) << "Lost key in " << dc.dc_id << ", restart dc_loop";
+ dc.state = DcInfo::State::Waiting;
+ }
CHECK(dc.shared_auth_data);
switch (dc.state) {
case DcInfo::State::Waiting: {
diff --git a/td/telegram/net/Session.cpp b/td/telegram/net/Session.cpp
index 431d91ab7..b700922bc 100644
--- a/td/telegram/net/Session.cpp
+++ b/td/telegram/net/Session.cpp
@@ -493,11 +493,14 @@ void Session::on_closed(Status status) {
} else {
// log out if has error and or 1 minute is passed from start, or 1 minute has passed since auth_key creation
if (!use_pfs_) {
+ LOG(WARNING) << "Use pfs to check main key";
auth_data_.set_use_pfs(true);
+ yield();
} else if (need_check_main_key_) {
LOG(WARNING) << "Invalidate main key";
auth_data_.drop_main_auth_key();
on_auth_key_updated();
+ yield();
}
}
}