Fix on_alarm_timeout.

GitOrigin-RevId: 45151d440833becc478abe8606ddc1369be3f262
This commit is contained in:
levlam 2018-06-13 21:21:29 +03:00
parent d4cc127f17
commit fe203b3d5c

View File

@ -3826,18 +3826,24 @@ void Td::on_alarm_timeout(int64 alarm_id) {
on_online_updated(false, true); on_online_updated(false, true);
return; return;
} }
if (alarm_id == PING_SERVER_ALARM_ID && updates_manager_ != nullptr) { if (alarm_id == PING_SERVER_ALARM_ID) {
updates_manager_->ping_server(); if (!close_flag_ && updates_manager_ != nullptr) {
alarm_timeout_.set_timeout_in(PING_SERVER_ALARM_ID, PING_SERVER_TIMEOUT + Random::fast(0, PING_SERVER_TIMEOUT / 5)); updates_manager_->ping_server();
alarm_timeout_.set_timeout_in(PING_SERVER_ALARM_ID,
PING_SERVER_TIMEOUT + Random::fast(0, PING_SERVER_TIMEOUT / 5));
}
return; return;
} }
if (alarm_id == TERMS_OF_SERVICE_ALARM_ID && !close_flag_) { if (alarm_id == TERMS_OF_SERVICE_ALARM_ID) {
get_terms_of_service( if (!close_flag_) {
this, PromiseCreator::lambda([actor_id = actor_id(this)](Result<std::pair<int32, TermsOfService>> result) { get_terms_of_service(
send_closure(actor_id, &Td::on_get_terms_of_service, std::move(result), false); this, PromiseCreator::lambda([actor_id = actor_id(this)](Result<std::pair<int32, TermsOfService>> result) {
})); send_closure(actor_id, &Td::on_get_terms_of_service, std::move(result), false);
}));
}
return; return;
} }
auto it = pending_alarms_.find(alarm_id); auto it = pending_alarms_.find(alarm_id);
CHECK(it != pending_alarms_.end()); CHECK(it != pending_alarms_.end());
uint64 request_id = it->second; uint64 request_id = it->second;
@ -4413,6 +4419,7 @@ void Td::clear() {
return; return;
} }
LOG(INFO) << "Clear Td";
close_flag_ = 2; close_flag_ = 2;
Timer timer; Timer timer;