Minor fixes.
GitOrigin-RevId: 28f8cabca2f70ba692f8713ec68866495061b31a
This commit is contained in:
parent
c489d7187e
commit
c5059bcac3
@ -21,6 +21,7 @@
|
||||
#include "td/telegram/net/NetQueryDispatcher.h"
|
||||
#include "td/telegram/NotificationManager.h"
|
||||
#include "td/telegram/PasswordManager.h"
|
||||
#include "td/telegram/StateManager.h"
|
||||
#include "td/telegram/StickersManager.h"
|
||||
#include "td/telegram/Td.h"
|
||||
#include "td/telegram/TdDb.h"
|
||||
@ -837,7 +838,7 @@ void AuthManager::update_state(State new_state, bool force, bool should_save_sta
|
||||
if (should_save_state) {
|
||||
save_state();
|
||||
}
|
||||
if (new_state == State::LoggingOut || new_state == State::DestroyingKeys || new_state == State::Closing) {
|
||||
if (new_state == State::LoggingOut || new_state == State::DestroyingKeys) {
|
||||
send_closure(G()->state_manager(), &StateManager::on_logging_out, true);
|
||||
}
|
||||
send_closure(G()->td(), &Td::send_update,
|
||||
|
@ -85,7 +85,7 @@ void StateManager::on_logging_out(bool is_logging_out) {
|
||||
|
||||
void StateManager::add_callback(unique_ptr<Callback> callback) {
|
||||
if (callback->on_network(network_type_, network_generation_) && callback->on_online(online_flag_) &&
|
||||
callback->on_state(get_real_state())) {
|
||||
callback->on_state(get_real_state()) && callback->on_logging_out(is_logging_out_)) {
|
||||
callbacks_.push_back(std::move(callback));
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ class StateManager final : public Actor {
|
||||
uint32 network_generation_ = 1;
|
||||
bool online_flag_ = false;
|
||||
bool use_proxy_ = false;
|
||||
bool is_logging_out_ = true;
|
||||
bool is_logging_out_ = false;
|
||||
|
||||
static constexpr double UP_DELAY = 0.05;
|
||||
static constexpr double DOWN_DELAY = 0.3;
|
||||
|
@ -569,19 +569,23 @@ void ConnectionCreator::on_online(bool online_flag) {
|
||||
online_flag_ = online_flag;
|
||||
if (need_drop_flood_control) {
|
||||
for (auto &client : clients_) {
|
||||
client.second.sanity_flood_control.clear_events();
|
||||
client.second.backoff.clear();
|
||||
client.second.sanity_flood_control.clear_events();
|
||||
client.second.flood_control_online.clear_events();
|
||||
client_loop(client.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
void ConnectionCreator::on_logging_out(bool is_logging_out) {
|
||||
if (is_logging_out_ == is_logging_out) {
|
||||
return;
|
||||
}
|
||||
|
||||
VLOG(connections) << "Receive logging out flag " << is_logging_out;
|
||||
is_logging_out_ = is_logging_out;
|
||||
for (auto &client : clients_) {
|
||||
client.second.sanity_flood_control.clear_events();
|
||||
client.second.backoff.clear();
|
||||
client.second.sanity_flood_control.clear_events();
|
||||
client.second.flood_control_online.clear_events();
|
||||
client_loop(client.second);
|
||||
}
|
||||
@ -879,6 +883,9 @@ void ConnectionCreator::client_loop(ClientInfo &client) {
|
||||
return client_set_timeout_at(client, wakeup_at);
|
||||
}
|
||||
client.sanity_flood_control.add_event(static_cast<int32>(Time::now()));
|
||||
if (!act_as_if_online) {
|
||||
client.backoff.add_event(static_cast<int32>(Time::now()));
|
||||
}
|
||||
|
||||
// Create new RawConnection
|
||||
// sync part
|
||||
@ -895,9 +902,6 @@ void ConnectionCreator::client_loop(ClientInfo &client) {
|
||||
|
||||
// Events with failed socket creation are ignored
|
||||
flood_control.add_event(static_cast<int32>(Time::now()));
|
||||
if (!act_as_if_online) {
|
||||
client.backoff.add_event(static_cast<int32>(Time::now()));
|
||||
}
|
||||
|
||||
auto socket_fd = r_socket_fd.move_as_ok();
|
||||
IPAddress debug_ip;
|
||||
|
@ -285,7 +285,7 @@ void Scheduler::do_event(ActorInfo *actor_info, Event &&event) {
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
// can't clear event here. It may be already destroyed during destory_actor
|
||||
// can't clear event here. It may be already destroyed during destroy_actor
|
||||
}
|
||||
|
||||
void Scheduler::register_migrated_actor(ActorInfo *actor_info) {
|
||||
|
Loading…
Reference in New Issue
Block a user