Wait TempAuthKeyWatchdog close.

GitOrigin-RevId: ab97787f7e7b5b716bb77faaf335239768f3c60f
This commit is contained in:
levlam 2020-07-19 18:18:54 +03:00
parent d7f44acf2e
commit 62e3adf6ef
2 changed files with 5 additions and 1 deletions

View File

@ -4276,7 +4276,7 @@ void Td::init_options_and_network() {
init_connection_creator();
VLOG(td_init) << "Create TempAuthKeyWatchdog";
auto temp_auth_key_watchdog = create_actor<TempAuthKeyWatchdog>("TempAuthKeyWatchdog");
auto temp_auth_key_watchdog = create_actor<TempAuthKeyWatchdog>("TempAuthKeyWatchdog", create_reference());
G()->set_temp_auth_key_watchdog(std::move(temp_auth_key_watchdog));
VLOG(td_init) << "Create ConfigManager";

View File

@ -43,6 +43,9 @@ class TempAuthKeyWatchdog : public NetQueryCallback {
};
public:
TempAuthKeyWatchdog(ActorShared<> parent) : parent_(std::move(parent)) {
}
using RegisteredAuthKey = unique_ptr<RegisteredAuthKeyImpl>;
static RegisteredAuthKey register_auth_key_id(int64 id) {
@ -54,6 +57,7 @@ class TempAuthKeyWatchdog : public NetQueryCallback {
static constexpr double SYNC_WAIT = 0.1;
static constexpr double SYNC_WAIT_MAX = 1.0;
ActorShared<> parent_;
std::map<uint64, uint32> id_count_;
double sync_at_ = 0;
bool need_sync_ = false;