Bugfixes in auth key validation

GitOrigin-RevId: 66c2002e3ccb48c333c580715dc3517665f57b1f
This commit is contained in:
Arseny Smirnov 2020-01-08 15:54:42 +00:00
parent 4922ae62e0
commit efc483551f
2 changed files with 7 additions and 0 deletions

View File

@ -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: {

View File

@ -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();
}
}
}