Improve logging.

This commit is contained in:
levlam 2023-01-14 23:08:50 +03:00
parent 1a732db19e
commit 973df16c88
3 changed files with 9 additions and 6 deletions

View File

@ -68,6 +68,7 @@ void StateManager::add_callback(unique_ptr<Callback> callback) {
callbacks_.push_back(std::move(callback)); callbacks_.push_back(std::move(callback));
} }
} }
void StateManager::wait_first_sync(Promise<> promise) { void StateManager::wait_first_sync(Promise<> promise) {
if (was_sync_) { if (was_sync_) {
return promise.set_value(Unit()); return promise.set_value(Unit());

View File

@ -333,12 +333,14 @@ void Session::on_network(bool network_flag, uint32 network_generation) {
} }
void Session::on_online(bool online_flag) { void Session::on_online(bool online_flag) {
LOG(DEBUG) << "Set online flag to " << online_flag;
online_flag_ = online_flag; online_flag_ = online_flag;
connection_online_update(true); connection_online_update(true);
loop(); loop();
} }
void Session::on_logging_out(bool logging_out_flag) { void Session::on_logging_out(bool logging_out_flag) {
LOG(DEBUG) << "Set logging out flag to " << logging_out_flag;
logging_out_flag_ = logging_out_flag; logging_out_flag_ = logging_out_flag;
connection_online_update(true); connection_online_update(true);
loop(); loop();

View File

@ -104,17 +104,17 @@ class Session final
// Just re-ask answer_id each time we get information about it. // Just re-ask answer_id each time we get information about it.
// Though mtproto::Connection must ensure delivery of such query. // Though mtproto::Connection must ensure delivery of such query.
int32 raw_dc_id_; // numerical datacenter ID, i.e. 2 const int32 raw_dc_id_; // numerical datacenter ID, i.e. 2
int32 dc_id_; // unique datacenter ID, i.e. -10002 const int32 dc_id_; // unique datacenter ID, i.e. -10002
enum class Mode : int8 { Tcp, Http } mode_ = Mode::Tcp; const bool is_main_; // true only for the primary Session(s) to the main DC
bool is_main_; // true only for the primary Session(s) to the main DC const bool is_cdn_;
bool is_cdn_; const bool need_destroy_;
bool need_destroy_;
bool was_on_network_ = false; bool was_on_network_ = false;
bool network_flag_ = false; bool network_flag_ = false;
bool online_flag_ = false; bool online_flag_ = false;
bool logging_out_flag_ = false; bool logging_out_flag_ = false;
bool connection_online_flag_ = false; bool connection_online_flag_ = false;
enum class Mode : int8 { Tcp, Http } mode_ = Mode::Tcp;
uint32 network_generation_ = 0; uint32 network_generation_ = 0;
uint64 being_binded_tmp_auth_key_id_ = 0; uint64 being_binded_tmp_auth_key_id_ = 0;
uint64 being_checked_main_auth_key_id_ = 0; uint64 being_checked_main_auth_key_id_ = 0;