Initialize Td::connection_state_ in header.

This commit is contained in:
levlam 2021-09-16 17:54:04 +03:00
parent 3cd1489eab
commit 34094328bd
2 changed files with 5 additions and 3 deletions

View File

@ -3533,7 +3533,7 @@ tl_object_ptr<td_api::ConnectionState> Td::get_connection_state_object(StateMana
case StateManager::State::Ready:
return make_tl_object<td_api::connectionStateReady>();
default:
UNREACHABLE();
LOG(FATAL) << "State = " << static_cast<int32>(state);
return nullptr;
}
}
@ -3543,6 +3543,9 @@ void Td::on_connection_state_changed(StateManager::State new_state) {
LOG(ERROR) << "State manager sends update about unchanged state " << static_cast<int32>(new_state);
return;
}
if (G()->close_flag()) {
return;
}
connection_state_ = new_state;
send_closure(actor_id(this), &Td::send_update,
@ -4105,7 +4108,6 @@ void Td::init_options_and_network() {
state_manager_ = create_actor<StateManager>("State manager", create_reference());
send_closure(state_manager_, &StateManager::add_callback, make_unique<StateManagerCallback>(create_reference()));
G()->set_state_manager(state_manager_.get());
connection_state_ = StateManager::State::Empty;
VLOG(td_init) << "Create ConfigShared";
G()->set_shared_config(td::make_unique<ConfigShared>(G()->td_db()->get_config_pmc_shared()));

View File

@ -278,7 +278,7 @@ class Td final : public Actor {
TdParameters parameters_;
StateManager::State connection_state_;
StateManager::State connection_state_ = StateManager::State::Empty;
std::unordered_multiset<uint64> request_set_;
int actor_refcnt_ = 0;