From 99c3946d410da6936c8d618d276e16cd27b99b8b Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 7 Feb 2018 23:48:40 +0300 Subject: [PATCH] More connection_recoverer logging. GitOrigin-RevId: c86cdef27ec3beacfe6883a100d95a36019a902b --- td/telegram/ConfigManager.cpp | 14 +++++++++++--- td/telegram/net/ConnectionCreator.cpp | 4 ++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/td/telegram/ConfigManager.cpp b/td/telegram/ConfigManager.cpp index 9ace49ed..50405663 100644 --- a/td/telegram/ConfigManager.cpp +++ b/td/telegram/ConfigManager.cpp @@ -106,6 +106,7 @@ Result decode_config(Slice input) { } ActorOwn<> get_simple_config_google_app(Promise promise, bool is_test, int32 scheduler_id) { + VLOG(config_recoverer) << "Request simple config from Google App"; #if TD_EMSCRIPTEN // FIXME return ActorOwn<>(); #else @@ -124,6 +125,7 @@ ActorOwn<> get_simple_config_google_app(Promise promise, bool is_t } ActorOwn<> get_simple_config_google_dns(Promise promise, bool is_test, int32 scheduler_id) { + VLOG(config_recoverer) << "Request simple config from Google DNS"; #if TD_EMSCRIPTEN // FIXME return ActorOwn<>(); #else @@ -178,16 +180,17 @@ ActorOwn<> get_full_config(IPAddress ip_address, Promise promise) { } void request_raw_connection(Promise> promise) final { request_raw_connection_cnt_++; + VLOG(config_recoverer) << "Request full config from " << address_ << ", try = " << request_raw_connection_cnt_; if (request_raw_connection_cnt_ <= 1) { send_closure(G()->connection_creator(), &ConnectionCreator::request_raw_connection_by_ip, address_, std::move(promise)); } else { - //Delay all queries but first forever + // Delay all queries except first forever delay_forever_.push_back(std::move(promise)); } } void on_tmp_auth_key_updated(mtproto::AuthKey auth_key) final { - //nop + // nop } private: @@ -432,6 +435,12 @@ class ConfigRecoverer : public Actor { return; } + if (is_connecting_) { + VLOG(config_recoverer) << "Failed to connect for " << Time::now_cached() - connecting_since_; + } else { + VLOG(config_recoverer) << "Successfully connected"; + } + Timestamp wakeup_timestamp; auto check_timeout = [&](Timestamp timestamp) { if (timestamp.at() < Time::now_cached()) { @@ -441,7 +450,6 @@ class ConfigRecoverer : public Actor { return false; }; - VLOG(config_recoverer) << is_connecting_ << " " << Time::now_cached() - connecting_since_; bool has_connecting_problem = is_connecting_ && check_timeout(Timestamp::at(connecting_since_ + max_connecting_delay())); bool is_valid_simple_config = !check_timeout(Timestamp::at(simple_config_expire_at_)); diff --git a/td/telegram/net/ConnectionCreator.cpp b/td/telegram/net/ConnectionCreator.cpp index 4bd82b36..90c97183 100644 --- a/td/telegram/net/ConnectionCreator.cpp +++ b/td/telegram/net/ConnectionCreator.cpp @@ -28,7 +28,9 @@ #include namespace td { + namespace detail { + class StatsCallback final : public mtproto::RawConnection::StatsCallback { public: StatsCallback(std::shared_ptr net_stats_callback, ActorId connection_creator, @@ -63,6 +65,7 @@ class StatsCallback final : public mtproto::RawConnection::StatsCallback { size_t hash_; DcOptionsSet::Stat *option_stat_; }; + class PingActor : public Actor { public: PingActor(std::unique_ptr raw_connection, @@ -135,6 +138,7 @@ class PingActor : public Actor { } } }; + } // namespace detail template