From bd9c88794e2574a402a764078886f797753037d2 Mon Sep 17 00:00:00 2001 From: Arseny Smirnov Date: Thu, 31 May 2018 16:56:06 +0300 Subject: [PATCH] Use pfs for media download GitOrigin-RevId: afaa0e04f02b2b3dfb8822dacd56c0473b019527 --- td/telegram/net/NetQueryDispatcher.cpp | 17 ++++++++++------- td/telegram/net/SessionMultiProxy.cpp | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/td/telegram/net/NetQueryDispatcher.cpp b/td/telegram/net/NetQueryDispatcher.cpp index dafa65fe0..9086d4874 100644 --- a/td/telegram/net/NetQueryDispatcher.cpp +++ b/td/telegram/net/NetQueryDispatcher.cpp @@ -146,19 +146,22 @@ Status NetQueryDispatcher::wait_dc_init(DcId dc_id, bool force) { int32 slow_net_scheduler_id = G()->get_slow_net_scheduler_id(); auto raw_dc_id = dc_id.get_raw_id(); + int32 upload_session_count = raw_dc_id != 2 && raw_dc_id != 4 ? 8 : 4; + int32 download_session_count = 1; + int32 download_small_session_count = 1; dc.main_session_ = create_actor(PSLICE() << "SessionMultiProxy:" << raw_dc_id << ":main", session_count, auth_data, raw_dc_id == main_dc_id_, use_pfs || (session_count > 1), false, false, is_cdn); dc.upload_session_ = create_actor_on_scheduler( - PSLICE() << "SessionMultiProxy:" << raw_dc_id << ":upload", slow_net_scheduler_id, - raw_dc_id != 2 && raw_dc_id != 4 ? 8 : 4, auth_data, false, use_pfs || (session_count > 1), false, true, - is_cdn); + PSLICE() << "SessionMultiProxy:" << raw_dc_id << ":upload", slow_net_scheduler_id, upload_session_count, + auth_data, false, use_pfs, false, true, is_cdn); dc.download_session_ = create_actor_on_scheduler( - PSLICE() << "SessionMultiProxy:" << raw_dc_id << ":download", slow_net_scheduler_id, 1, auth_data, false, - use_pfs, true, true, is_cdn); + PSLICE() << "SessionMultiProxy:" << raw_dc_id << ":download", slow_net_scheduler_id, download_session_count, + auth_data, false, use_pfs || (download_session_count > 1), true, true, is_cdn); dc.download_small_session_ = create_actor_on_scheduler( - PSLICE() << "SessionMultiProxy:" << raw_dc_id << ":download_small", slow_net_scheduler_id, 1, auth_data, false, - use_pfs, true, true, is_cdn); + PSLICE() << "SessionMultiProxy:" << raw_dc_id << ":download_small", slow_net_scheduler_id, + download_small_session_count, auth_data, false, use_pfs || (download_small_session_count > 1), true, true, + is_cdn); dc.is_inited_ = true; if (dc_id.is_internal()) { send_closure_later(dc_auth_manager_, &DcAuthManager::add_dc, std::move(auth_data)); diff --git a/td/telegram/net/SessionMultiProxy.cpp b/td/telegram/net/SessionMultiProxy.cpp index 3ed434eb8..352050409 100644 --- a/td/telegram/net/SessionMultiProxy.cpp +++ b/td/telegram/net/SessionMultiProxy.cpp @@ -96,7 +96,7 @@ void SessionMultiProxy::start_up() { } bool SessionMultiProxy::get_pfs_flag() const { - return (!allow_media_only_ && use_pfs_); // pfs is not supported in media only DCs + return use_pfs_; } void SessionMultiProxy::init() {