trying to fix bug when active temporary auth key is dropped

This commit is contained in:
Arseny Smirnov 2022-06-20 13:18:25 +02:00
parent 7eabd8ca60
commit 8ac019e589
2 changed files with 5 additions and 0 deletions

View File

@ -227,6 +227,9 @@ Session::Session(unique_ptr<Callback> callback, std::shared_ptr<AuthDataShared>
auth_data_.set_future_salts(shared_auth_data_->get_future_salts(), Time::now());
if (use_pfs && !tmp_auth_key.empty()) {
auth_data_.set_tmp_auth_key(tmp_auth_key);
if (is_main_) {
registered_temp_auth_key_ = TempAuthKeyWatchdog::register_auth_key_id(auth_data_.get_tmp_auth_key().id());
}
auth_data_.set_future_salts(server_salts, Time::now());
}
uint64 session_id = 0;

View File

@ -63,6 +63,7 @@ class TempAuthKeyWatchdog final : public NetQueryCallback {
bool run_sync_ = false;
void register_auth_key_id_impl(int64 id) {
LOG(INFO) << "Register key " << id;
if (!++id_count_[id]) {
id_count_.erase(id);
}
@ -70,6 +71,7 @@ class TempAuthKeyWatchdog final : public NetQueryCallback {
}
void unregister_auth_key_id_impl(int64 id) {
LOG(INFO) << "Unregister key " << id;
if (!--id_count_[id]) {
id_count_.erase(id);
}