diff --git a/td/telegram/net/Session.cpp b/td/telegram/net/Session.cpp index 2c6ea18f1..7cd34f99b 100644 --- a/td/telegram/net/Session.cpp +++ b/td/telegram/net/Session.cpp @@ -233,7 +233,7 @@ bool Session::PriorityQueue::empty() const { Session::Session(unique_ptr callback, std::shared_ptr shared_auth_data, int32 raw_dc_id, int32 dc_id, bool is_primary, bool is_main, bool use_pfs, bool persist_tmp_auth_key, bool is_cdn, - bool need_destroy, const mtproto::AuthKey &tmp_auth_key, + bool need_destroy_auth_key, const mtproto::AuthKey &tmp_auth_key, const vector &server_salts) : raw_dc_id_(raw_dc_id) , dc_id_(dc_id) @@ -241,9 +241,9 @@ Session::Session(unique_ptr callback, std::shared_ptr , is_main_(is_main) , persist_tmp_auth_key_(use_pfs && persist_tmp_auth_key) , is_cdn_(is_cdn) - , need_destroy_(need_destroy) { - VLOG(dc) << "Start connection " << tag("need_destroy", need_destroy_); - if (need_destroy_) { + , need_destroy_auth_key_(need_destroy_auth_key) { + VLOG(dc) << "Start connection " << tag("need_destroy_auth_key", need_destroy_auth_key_); + if (need_destroy_auth_key_) { use_pfs = false; CHECK(!is_cdn); } @@ -292,7 +292,7 @@ bool Session::is_high_loaded() { } bool Session::can_destroy_auth_key() const { - return need_destroy_; + return need_destroy_auth_key_; } void Session::start_up() { @@ -635,7 +635,7 @@ void Session::on_closed(Status status) { auth_data_.drop_main_auth_key(); on_auth_key_updated(); on_session_failed(status.clone()); - } else if (need_destroy_) { + } else if (need_destroy_auth_key_) { LOG(WARNING) << "Session connection was closed, because main auth_key has been successfully destroyed"; auth_data_.drop_main_auth_key(); on_auth_key_updated(); @@ -1511,7 +1511,7 @@ void Session::loop() { if (cached_connection_timestamp_ < now - 10) { cached_connection_.reset(); } - if (!is_main_ && !has_queries() && !need_destroy_ && last_activity_timestamp_ < now - ACTIVITY_TIMEOUT) { + if (!is_main_ && !has_queries() && !need_destroy_auth_key_ && last_activity_timestamp_ < now - ACTIVITY_TIMEOUT) { on_session_failed(Status::OK()); } diff --git a/td/telegram/net/Session.h b/td/telegram/net/Session.h index ecacb5c29..ebf9860dc 100644 --- a/td/telegram/net/Session.h +++ b/td/telegram/net/Session.h @@ -68,8 +68,9 @@ class Session final }; Session(unique_ptr callback, std::shared_ptr shared_auth_data, int32 raw_dc_id, int32 dc_id, - bool is_primary, bool is_main, bool use_pfs, bool persist_tmp_auth_key, bool is_cdn, bool need_destroy, - const mtproto::AuthKey &tmp_auth_key, const vector &server_salts); + bool is_primary, bool is_main, bool use_pfs, bool persist_tmp_auth_key, bool is_cdn, + bool need_destroy_auth_key, const mtproto::AuthKey &tmp_auth_key, + const vector &server_salts); void send(NetQueryPtr &&query); @@ -115,7 +116,7 @@ class Session final const bool is_main_; // true only for the primary Session(s) to the main DC const bool persist_tmp_auth_key_; const bool is_cdn_; - const bool need_destroy_; + const bool need_destroy_auth_key_; bool was_on_network_ = false; bool network_flag_ = false; bool online_flag_ = false; diff --git a/td/telegram/net/SessionProxy.cpp b/td/telegram/net/SessionProxy.cpp index 701611b98..1580360d6 100644 --- a/td/telegram/net/SessionProxy.cpp +++ b/td/telegram/net/SessionProxy.cpp @@ -93,7 +93,7 @@ class SessionCallback final : public Session::Callback { SessionProxy::SessionProxy(unique_ptr callback, std::shared_ptr shared_auth_data, bool is_primary, bool is_main, bool allow_media_only, bool is_media, bool use_pfs, - bool persist_tmp_auth_key, bool is_cdn, bool need_destroy) + bool persist_tmp_auth_key, bool is_cdn, bool need_destroy_auth_key) : callback_(std::move(callback)) , auth_data_(std::move(shared_auth_data)) , is_primary_(is_primary) @@ -103,7 +103,7 @@ SessionProxy::SessionProxy(unique_ptr callback, std::shared_ptr( name, make_unique(actor_shared(this, session_generation_), dc_id, allow_media_only_, is_media_, hash), - auth_data_, raw_dc_id, int_dc_id, is_primary_, is_main_, use_pfs_, persist_tmp_auth_key_, is_cdn_, need_destroy_, - tmp_auth_key_, server_salts_); + auth_data_, raw_dc_id, int_dc_id, is_primary_, is_main_, use_pfs_, persist_tmp_auth_key_, is_cdn_, + need_destroy_auth_key_, tmp_auth_key_, server_salts_); } void SessionProxy::update_auth_key_state() { diff --git a/td/telegram/net/SessionProxy.h b/td/telegram/net/SessionProxy.h index c5b0b6686..e15d93bc0 100644 --- a/td/telegram/net/SessionProxy.h +++ b/td/telegram/net/SessionProxy.h @@ -34,7 +34,7 @@ class SessionProxy final : public Actor { SessionProxy(unique_ptr callback, std::shared_ptr shared_auth_data, bool is_primary, bool is_main, bool allow_media_only, bool is_media, bool use_pfs, bool persist_tmp_auth_key, bool is_cdn, - bool need_destroy); + bool need_destroy_auth_key); void send(NetQueryPtr query); @@ -57,7 +57,7 @@ class SessionProxy final : public Actor { mtproto::AuthKey tmp_auth_key_; std::vector server_salts_; bool is_cdn_; - bool need_destroy_; + bool need_destroy_auth_key_; ActorOwn session_; std::vector pending_queries_; uint64 session_generation_ = 1;