Update layer 78.
GitOrigin-RevId: 8aac14c20fc90c6a0b118fbbe80d4b83034416a2
This commit is contained in:
parent
de0614891d
commit
821bc642cf
@ -342,7 +342,7 @@ upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes
|
||||
|
||||
dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption;
|
||||
|
||||
config#86b5778e flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string suggested_lang_code:flags.2?string lang_pack_version:flags.2?int = Config;
|
||||
config#eb7bb160 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string suggested_lang_code:flags.2?string lang_pack_version:flags.2?int = Config;
|
||||
|
||||
nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc;
|
||||
|
||||
|
Binary file not shown.
@ -359,7 +359,7 @@ class ConfigRecoverer : public Actor {
|
||||
if (r_dc_options.is_ok()) {
|
||||
simple_config_ = r_dc_options.move_as_ok();
|
||||
VLOG(config_recoverer) << "Got SimpleConfig " << simple_config_;
|
||||
simple_config_expire_at_ = Time::now_cached() + Random::fast(20 * 60, 30 * 60);
|
||||
simple_config_expire_at_ = get_config_expire_time();
|
||||
simple_config_at_ = Time::now_cached();
|
||||
for (size_t i = 1; i < simple_config_.dc_options.size(); i++) {
|
||||
std::swap(simple_config_.dc_options[i], simple_config_.dc_options[Random::fast(0, static_cast<int>(i))]);
|
||||
@ -367,7 +367,7 @@ class ConfigRecoverer : public Actor {
|
||||
} else {
|
||||
VLOG(config_recoverer) << "Get SimpleConfig error " << r_dc_options.error();
|
||||
simple_config_ = DcOptions();
|
||||
simple_config_expire_at_ = Time::now_cached() + Random::fast(15, 30);
|
||||
simple_config_expire_at_ = get_failed_config_expire_time();
|
||||
}
|
||||
update_dc_options();
|
||||
loop();
|
||||
@ -378,16 +378,28 @@ class ConfigRecoverer : public Actor {
|
||||
if (r_full_config.is_ok()) {
|
||||
full_config_ = r_full_config.move_as_ok();
|
||||
VLOG(config_recoverer) << "Got FullConfig " << to_string(full_config_);
|
||||
full_config_expire_at_ = Time::now() + Random::fast(20 * 60, 30 * 60);
|
||||
full_config_expire_at_ = get_config_expire_time();
|
||||
send_closure(G()->connection_creator(), &ConnectionCreator::on_dc_options, DcOptions(full_config_->dc_options_));
|
||||
} else {
|
||||
VLOG(config_recoverer) << "Get FullConfig error " << r_full_config.error();
|
||||
full_config_ = FullConfig();
|
||||
full_config_expire_at_ = Time::now() + Random::fast(15, 30);
|
||||
full_config_expire_at_ = get_failed_config_expire_time();
|
||||
}
|
||||
loop();
|
||||
}
|
||||
|
||||
bool expect_blocking() const {
|
||||
return G()->shared_config().get_option_boolean("expect_blocking", true);
|
||||
}
|
||||
|
||||
double get_config_expire_time() const {
|
||||
return Time::now() + (expect_blocking() ? Random::fast(2 * 60, 3 * 60) : Random::fast(20 * 60, 30 * 60));
|
||||
}
|
||||
|
||||
double get_failed_config_expire_time() const {
|
||||
return Time::now() + (expect_blocking() ? Random::fast(5, 7) : Random::fast(15, 30));
|
||||
}
|
||||
|
||||
bool is_connecting_{false};
|
||||
double connecting_since_{0};
|
||||
|
||||
@ -437,7 +449,7 @@ class ConfigRecoverer : public Actor {
|
||||
}
|
||||
|
||||
double max_connecting_delay() const {
|
||||
return 20;
|
||||
return expect_blocking() ? 5 : 20;
|
||||
}
|
||||
void loop() override {
|
||||
if (close_flag_) {
|
||||
@ -470,7 +482,8 @@ class ConfigRecoverer : public Actor {
|
||||
bool has_dc_options = !dc_options_.dc_options.empty();
|
||||
bool is_valid_full_config = !check_timeout(Timestamp::at(full_config_expire_at_));
|
||||
bool need_full_config = has_connecting_problem && has_dc_options && !is_valid_full_config &&
|
||||
full_config_query_.empty() && check_timeout(Timestamp::at(dc_options_at_ + 10));
|
||||
full_config_query_.empty() &&
|
||||
check_timeout(Timestamp::at(dc_options_at_ + (expect_blocking() ? 5 : 10)));
|
||||
if (need_simple_config) {
|
||||
ref_cnt_++;
|
||||
VLOG(config_recoverer) << "ASK SIMPLE CONFIG";
|
||||
@ -687,6 +700,10 @@ void ConfigManager::process_config(tl_object_ptr<telegram_api::config> config) {
|
||||
shared_config.set_option_integer("basic_group_size_max", config->chat_size_max_);
|
||||
shared_config.set_option_integer("supergroup_size_max", config->megagroup_size_max_);
|
||||
shared_config.set_option_integer("pinned_chat_count_max", config->pinned_dialogs_count_max_);
|
||||
if (is_from_main_dc || !shared_config.have_option("expect_blocking")) {
|
||||
shared_config.set_option_integer("expect_blocking",
|
||||
(config->flags_ & telegram_api::config::BLOCKED_MODE_MASK) != 0);
|
||||
}
|
||||
if (is_from_main_dc || !shared_config.have_option("t_me_url")) {
|
||||
shared_config.set_option_string("t_me_url", config->me_url_prefix_);
|
||||
}
|
||||
|
@ -58,10 +58,10 @@ std::unordered_map<string, string> ConfigShared::get_options() const {
|
||||
return config_pmc_->get_all();
|
||||
}
|
||||
|
||||
bool ConfigShared::get_option_boolean(Slice name) const {
|
||||
bool ConfigShared::get_option_boolean(Slice name, bool default_value) const {
|
||||
auto value = get_option(name);
|
||||
if (value.empty()) {
|
||||
return false;
|
||||
return default_value;
|
||||
}
|
||||
if (value == "Btrue") {
|
||||
return true;
|
||||
@ -70,7 +70,7 @@ bool ConfigShared::get_option_boolean(Slice name) const {
|
||||
return false;
|
||||
}
|
||||
LOG(ERROR) << "Found \"" << value << "\" instead of boolean option";
|
||||
return false;
|
||||
return default_value;
|
||||
}
|
||||
|
||||
int32 ConfigShared::get_option_integer(Slice name, int32 default_value) const {
|
||||
|
@ -39,7 +39,7 @@ class ConfigShared {
|
||||
std::unordered_map<string, string> get_options(Slice prefix) const;
|
||||
std::unordered_map<string, string> get_options() const;
|
||||
|
||||
bool get_option_boolean(Slice name) const;
|
||||
bool get_option_boolean(Slice name, bool default_value = false) const;
|
||||
int32 get_option_integer(Slice name, int32 default_value = 0) const;
|
||||
|
||||
tl_object_ptr<td_api::OptionValue> get_option_value(Slice value) const;
|
||||
|
@ -4102,7 +4102,7 @@ bool Td::is_internal_config_option(Slice name) {
|
||||
return name == "call_ring_timeout_ms" || name == "call_receive_timeout_ms" || name == "channels_read_media_period" ||
|
||||
name == "edit_time_limit" || name == "revoke_pm_inbox" || name == "revoke_time_limit" ||
|
||||
name == "revoke_pm_time_limit" || name == "rating_e_decay" || name == "saved_animations_limit" ||
|
||||
name == "recent_stickers_limit" || name == "auth";
|
||||
name == "recent_stickers_limit" || name == "expect_blocking" || name == "auth";
|
||||
}
|
||||
|
||||
void Td::on_config_option_updated(const string &name) {
|
||||
|
Loading…
Reference in New Issue
Block a user