Don't resave DcOptions on launch.

This commit is contained in:
levlam 2024-02-28 13:47:17 +03:00
parent 36e95649cc
commit f8342527ca
2 changed files with 6 additions and 2 deletions

View File

@ -1033,6 +1033,10 @@ void ConnectionCreator::on_dc_options(DcOptions new_dc_options) {
VLOG(connections) << "SAVE " << new_dc_options;
G()->td_db()->get_binlog_pmc()->set("dc_options", serialize(new_dc_options));
dc_options_set_.reset();
add_dc_options(std::move(new_dc_options));
}
void ConnectionCreator::add_dc_options(DcOptions &&new_dc_options) {
dc_options_set_.add_dc_options(get_default_dc_options(G()->is_test_dc()));
#if !TD_EMSCRIPTEN // FIXME
dc_options_set_.add_dc_options(std::move(new_dc_options));
@ -1091,7 +1095,7 @@ void ConnectionCreator::start_up() {
if (status.is_error()) {
on_dc_options(DcOptions());
} else {
on_dc_options(std::move(dc_options));
add_dc_options(std::move(dc_options));
}
if (G()->td_db()->get_binlog_pmc()->get("proxy_max_id") != "2" ||

View File

@ -206,7 +206,7 @@ class ConnectionCreator final : public NetQueryCallback {
void loop() final;
void init_proxies();
void save_dc_options();
void add_dc_options(DcOptions &&new_dc_options);
Result<SocketFd> do_request_connection(DcId dc_id, bool allow_media_only);
Result<std::pair<unique_ptr<mtproto::RawConnection>, bool>> do_request_raw_connection(DcId dc_id,
bool allow_media_only,