Update layer to 79. Some fixes.

GitOrigin-RevId: 9356eee58e48d7c191a1bccb7e25d6875a07fb51
This commit is contained in:
levlam 2018-04-24 19:21:47 +03:00
parent b03fff4ff0
commit 1a0c874a67
19 changed files with 45 additions and 9 deletions

View File

@ -340,7 +340,7 @@ photos.photo#20212ca8 photo:Photo users:Vector<User> = photos.Photo;
upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File;
upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector<FileHash> = upload.File;
dcOption#5d8c6cc 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 = DcOption;
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;

Binary file not shown.

View File

@ -477,7 +477,7 @@ class ConfigRecoverer : public Actor {
auto promise = PromiseCreator::lambda([actor_id = actor_shared(this)](Result<SimpleConfig> r_simple_config) {
send_closure(actor_id, &ConfigRecoverer::on_simple_config, std::move(r_simple_config), false);
});
auto get_dimple_config = [&]() {
auto get_simple_config = [&]() {
switch (simple_config_turn_ % 3) {
case 0:
return get_simple_config_azure;
@ -488,7 +488,7 @@ class ConfigRecoverer : public Actor {
return get_simple_config_google_dns;
}
}();
simple_config_query_ = get_dimple_config(std::move(promise), G()->is_test_dc(), G()->get_gc_scheduler_id());
simple_config_query_ = get_simple_config(std::move(promise), G()->is_test_dc(), G()->get_gc_scheduler_id());
simple_config_turn_++;
}

View File

@ -958,6 +958,14 @@ Result<SecureValueWithCredentials> decrypt_secure_value(FileManager *file_manage
case SecureValueType::PhoneNumber:
res.data = encrypted_secure_value.data.data;
break;
case SecureValueType::UtilityBill:
case SecureValueType::BankStatement:
case SecureValueType::RentalAgreement: {
TRY_RESULT(files, decrypt_secure_files(file_manager, secret, encrypted_secure_value.files));
res.files = std::move(files.first);
res_credentials.files = std::move(files.second);
break;
}
default: {
TRY_RESULT(data, decrypt_secure_data(secret, encrypted_secure_value.data));
res.data = std::move(data.first);
@ -1051,6 +1059,14 @@ EncryptedSecureValue encrypt_secure_value(FileManager *file_manager, const secur
res.data = EncryptedSecureData{secure_value.data, "", ""};
res.hash = secure_storage::calc_value_hash(secure_value.data).as_slice().str();
break;
case SecureValueType::UtilityBill:
case SecureValueType::BankStatement:
case SecureValueType::RentalAgreement: {
string to_hash;
res.files = encrypt_secure_files(file_manager, master_secret, secure_value.files, to_hash);
res.hash = secure_storage::calc_value_hash(to_hash).as_slice().str();
break;
}
default: {
string to_hash;
res.data = encrypt_secure_data(master_secret, secure_value.data, to_hash);

View File

@ -5,10 +5,12 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
#include "td/utils/logging.h"
#include "td/utils/StringBuilder.h"
namespace td {
class DcId {
public:
DcId() = default;

View File

@ -19,6 +19,7 @@
#include "td/utils/tl_helpers.h"
namespace td {
class DcOption {
// do not forget to update PrintFlags
enum Flags : int32 { IPv6 = 1, MediaOnly = 2, ObfuscatedTcpOnly = 4, Cdn = 8, Static = 16 };
@ -201,7 +202,9 @@ class DcOptions {
std::vector<DcOption> dc_options;
};
inline StringBuilder &operator<<(StringBuilder &sb, const DcOptions &dc_options) {
return sb << "DcOptions" << format::as_array(dc_options.dc_options);
}
}; // namespace td

View File

@ -16,6 +16,7 @@
#include <map>
namespace td {
class DcOptionsSet {
public:
void add_dc_options(DcOptions dc_options);
@ -102,4 +103,5 @@ class DcOptionsSet {
void init_option_stat(DcOptionInfo *option_info);
OptionStat *get_option_stat(const DcOptionInfo *option_info);
};
} // namespace td

View File

@ -18,7 +18,7 @@ class HeaderStorer {
}
template <class StorerT>
void store(StorerT &storer) const {
constexpr int32 LAYER = 78;
constexpr int32 LAYER = 79;
using td::store;
// invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;

View File

@ -10,6 +10,7 @@
#include "td/utils/Slice.h"
namespace td {
class MtprotoHeader {
public:
struct Options {

View File

@ -9,6 +9,7 @@
#include "td/telegram/Global.h"
namespace td {
ListNode net_query_list_;
int32 NetQuery::get_my_id() {

View File

@ -9,6 +9,7 @@
#include "td/utils/Gzip.h"
namespace td {
NetQueryCreator::Ptr NetQueryCreator::create(uint64 id, const Storer &storer, DcId dc_id, NetQuery::Type type,
NetQuery::AuthFlag auth_flag, NetQuery::GzipFlag gzip_flag,
double total_timeout_limit) {
@ -37,4 +38,5 @@ NetQueryCreator::Ptr NetQueryCreator::create(uint64 id, const Storer &storer, Dc
query->total_timeout_limit = total_timeout_limit;
return query;
}
} // namespace td

View File

@ -14,6 +14,7 @@
#include "td/utils/Storer.h"
namespace td {
class NetQueryCreator {
public:
using Ptr = NetQueryPtr;
@ -51,4 +52,5 @@ class NetQueryCreator {
private:
ObjectPool<NetQuery> object_pool_;
};
} // namespace td

View File

@ -21,15 +21,12 @@
#include <mutex>
namespace td {
class NetQueryDelayer;
class DataCenter;
class DcAuthManager;
class SessionMultiProxy;
class PublicRsaKeyShared;
class PublicRsaKeyWatchdog;
} // namespace td
namespace td {
// Not just dispatcher.
class NetQueryDispatcher {

View File

@ -11,6 +11,7 @@
#include "td/utils/logging.h"
namespace td {
enum class NetType : int8 { Other, Wifi, Mobile, MobileRoaming, Size, None, Unknown };
inline NetType from_td_api(tl_object_ptr<td_api::NetworkType> &net_type) {

View File

@ -199,7 +199,7 @@ void Session::connection_online_update(bool force) {
void Session::send(NetQueryPtr &&query) {
last_activity_timestamp_ = Time::now();
query->debug("Session: received from DataCenter");
query->debug("Session: received from SessionProxy");
query->set_session_id(auth_data_.session_id_);
VLOG(net_query) << "got query " << query;
if (query->update_is_ready()) {

View File

@ -14,6 +14,7 @@
#include <memory>
namespace td {
class SessionProxy;
class SessionMultiProxy : public Actor {
@ -50,4 +51,5 @@ class SessionMultiProxy : public Actor {
void update_auth_state();
};
} // namespace td

View File

@ -17,6 +17,7 @@
#include <functional>
namespace td {
namespace mtproto {
class RawConnection;
} // namespace mtproto
@ -179,4 +180,5 @@ void SessionProxy::on_tmp_auth_key_updated(mtproto::AuthKey auth_key) {
LOG(WARNING) << "tmp_auth_key " << auth_key.id() << ": " << state;
tmp_auth_key_ = std::move(auth_key);
}
} // namespace td

View File

@ -13,7 +13,9 @@
#include <memory>
namespace td {
class Session;
class SessionProxy : public Actor {
public:
friend class SessionCallback;
@ -49,4 +51,5 @@ class SessionProxy : public Actor {
void start_up() override;
void tear_down() override;
};
} // namespace td

View File

@ -22,6 +22,7 @@
#include <map>
namespace td {
class TempAuthKeyWatchdog : public NetQueryCallback {
class RegisteredAuthKeyImpl {
public:
@ -124,4 +125,5 @@ class TempAuthKeyWatchdog : public NetQueryCallback {
try_sync();
}
};
} // namespace td