More connection_recoverer logging.

GitOrigin-RevId: c86cdef27ec3beacfe6883a100d95a36019a902b
This commit is contained in:
levlam 2018-02-07 23:48:40 +03:00
parent 154022ebfe
commit 99c3946d41
2 changed files with 15 additions and 3 deletions

View File

@ -106,6 +106,7 @@ Result<SimpleConfig> decode_config(Slice input) {
} }
ActorOwn<> get_simple_config_google_app(Promise<SimpleConfig> promise, bool is_test, int32 scheduler_id) { ActorOwn<> get_simple_config_google_app(Promise<SimpleConfig> promise, bool is_test, int32 scheduler_id) {
VLOG(config_recoverer) << "Request simple config from Google App";
#if TD_EMSCRIPTEN // FIXME #if TD_EMSCRIPTEN // FIXME
return ActorOwn<>(); return ActorOwn<>();
#else #else
@ -124,6 +125,7 @@ ActorOwn<> get_simple_config_google_app(Promise<SimpleConfig> promise, bool is_t
} }
ActorOwn<> get_simple_config_google_dns(Promise<SimpleConfig> promise, bool is_test, int32 scheduler_id) { ActorOwn<> get_simple_config_google_dns(Promise<SimpleConfig> promise, bool is_test, int32 scheduler_id) {
VLOG(config_recoverer) << "Request simple config from Google DNS";
#if TD_EMSCRIPTEN // FIXME #if TD_EMSCRIPTEN // FIXME
return ActorOwn<>(); return ActorOwn<>();
#else #else
@ -178,16 +180,17 @@ ActorOwn<> get_full_config(IPAddress ip_address, Promise<FullConfig> promise) {
} }
void request_raw_connection(Promise<std::unique_ptr<mtproto::RawConnection>> promise) final { void request_raw_connection(Promise<std::unique_ptr<mtproto::RawConnection>> promise) final {
request_raw_connection_cnt_++; request_raw_connection_cnt_++;
VLOG(config_recoverer) << "Request full config from " << address_ << ", try = " << request_raw_connection_cnt_;
if (request_raw_connection_cnt_ <= 1) { if (request_raw_connection_cnt_ <= 1) {
send_closure(G()->connection_creator(), &ConnectionCreator::request_raw_connection_by_ip, address_, send_closure(G()->connection_creator(), &ConnectionCreator::request_raw_connection_by_ip, address_,
std::move(promise)); std::move(promise));
} else { } else {
//Delay all queries but first forever // Delay all queries except first forever
delay_forever_.push_back(std::move(promise)); delay_forever_.push_back(std::move(promise));
} }
} }
void on_tmp_auth_key_updated(mtproto::AuthKey auth_key) final { void on_tmp_auth_key_updated(mtproto::AuthKey auth_key) final {
//nop // nop
} }
private: private:
@ -432,6 +435,12 @@ class ConfigRecoverer : public Actor {
return; 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; Timestamp wakeup_timestamp;
auto check_timeout = [&](Timestamp timestamp) { auto check_timeout = [&](Timestamp timestamp) {
if (timestamp.at() < Time::now_cached()) { if (timestamp.at() < Time::now_cached()) {
@ -441,7 +450,6 @@ class ConfigRecoverer : public Actor {
return false; return false;
}; };
VLOG(config_recoverer) << is_connecting_ << " " << Time::now_cached() - connecting_since_;
bool has_connecting_problem = bool has_connecting_problem =
is_connecting_ && check_timeout(Timestamp::at(connecting_since_ + max_connecting_delay())); is_connecting_ && check_timeout(Timestamp::at(connecting_since_ + max_connecting_delay()));
bool is_valid_simple_config = !check_timeout(Timestamp::at(simple_config_expire_at_)); bool is_valid_simple_config = !check_timeout(Timestamp::at(simple_config_expire_at_));

View File

@ -28,7 +28,9 @@
#include <algorithm> #include <algorithm>
namespace td { namespace td {
namespace detail { namespace detail {
class StatsCallback final : public mtproto::RawConnection::StatsCallback { class StatsCallback final : public mtproto::RawConnection::StatsCallback {
public: public:
StatsCallback(std::shared_ptr<NetStatsCallback> net_stats_callback, ActorId<ConnectionCreator> connection_creator, StatsCallback(std::shared_ptr<NetStatsCallback> net_stats_callback, ActorId<ConnectionCreator> connection_creator,
@ -63,6 +65,7 @@ class StatsCallback final : public mtproto::RawConnection::StatsCallback {
size_t hash_; size_t hash_;
DcOptionsSet::Stat *option_stat_; DcOptionsSet::Stat *option_stat_;
}; };
class PingActor : public Actor { class PingActor : public Actor {
public: public:
PingActor(std::unique_ptr<mtproto::RawConnection> raw_connection, PingActor(std::unique_ptr<mtproto::RawConnection> raw_connection,
@ -135,6 +138,7 @@ class PingActor : public Actor {
} }
} }
}; };
} // namespace detail } // namespace detail
template <class T> template <class T>