From 0be320a6c7434af8c34b047c1377d90b0f9d0a39 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 24 Feb 2022 19:14:37 +0300 Subject: [PATCH] Export media, updates and stream parts through media cluster. --- Telegram/SourceFiles/mtproto/facade.h | 8 ++++++++ Telegram/SourceFiles/mtproto/mtproto_dc_options.cpp | 2 +- Telegram/SourceFiles/mtproto/session_private.cpp | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/mtproto/facade.h b/Telegram/SourceFiles/mtproto/facade.h index ca6e245c91..59295b3b8b 100644 --- a/Telegram/SourceFiles/mtproto/facade.h +++ b/Telegram/SourceFiles/mtproto/facade.h @@ -62,6 +62,14 @@ inline constexpr bool isDownloadDcId(ShiftedDcId shiftedDcId) { && (shiftedDcId < details::downloadDcId(0, kMaxMediaDcCount - 1) + kDcShift); } +inline constexpr bool isMediaClusterDcId(ShiftedDcId shiftedDcId) { + const auto shift = GetDcIdShift(shiftedDcId); + return isDownloadDcId(shiftedDcId) + || (shift == kGroupCallStreamDcShift) + || (shift == kExportMediaDcShift) + || (shift == kUpdaterDcShift); +} + inline bool isCdnDc(MTPDdcOption::Flags flags) { return (flags & MTPDdcOption::Flag::f_cdn); } diff --git a/Telegram/SourceFiles/mtproto/mtproto_dc_options.cpp b/Telegram/SourceFiles/mtproto/mtproto_dc_options.cpp index b6ef68f9bc..ec1b4f549e 100644 --- a/Telegram/SourceFiles/mtproto/mtproto_dc_options.cpp +++ b/Telegram/SourceFiles/mtproto/mtproto_dc_options.cpp @@ -604,7 +604,7 @@ DcType DcOptions::dcType(ShiftedDcId shiftedDcId) const { return DcType::Cdn; } const auto dcId = BareDcId(shiftedDcId); - if (isDownloadDcId(shiftedDcId) && hasMediaOnlyOptionsFor(dcId)) { + if (isMediaClusterDcId(shiftedDcId) && hasMediaOnlyOptionsFor(dcId)) { return DcType::MediaCluster; } return DcType::Regular; diff --git a/Telegram/SourceFiles/mtproto/session_private.cpp b/Telegram/SourceFiles/mtproto/session_private.cpp index d830335ab6..d7b470a5de 100644 --- a/Telegram/SourceFiles/mtproto/session_private.cpp +++ b/Telegram/SourceFiles/mtproto/session_private.cpp @@ -223,7 +223,7 @@ void SessionPrivate::appendTestConnection( }); }); - const auto protocolForFiles = isDownloadDcId(_shiftedDcId) + const auto protocolForFiles = isMediaClusterDcId(_shiftedDcId) //|| isUploadDcId(_shiftedDcId) || (_realDcType == DcType::Cdn); const auto protocolDcId = getProtocolDcId();