2018-12-31 20:04:05 +01:00
|
|
|
//
|
2024-01-01 01:07:21 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
2018-12-31 20:04:05 +01:00
|
|
|
//
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "td/telegram/net/NetActor.h"
|
|
|
|
#include "td/telegram/net/NetQueryCreator.h"
|
|
|
|
#include "td/telegram/net/NetQueryDispatcher.h"
|
2021-10-27 16:32:09 +02:00
|
|
|
#include "td/telegram/net/PublicRsaKeyShared.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/telegram/telegram_api.h"
|
|
|
|
|
|
|
|
#include "td/actor/actor.h"
|
|
|
|
|
|
|
|
#include "td/utils/buffer.h"
|
|
|
|
#include "td/utils/common.h"
|
|
|
|
#include "td/utils/FloodControlStrict.h"
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
namespace td {
|
2018-06-25 23:10:53 +02:00
|
|
|
|
2021-07-04 04:58:54 +02:00
|
|
|
class PublicRsaKeyWatchdog final : public NetActor {
|
2018-12-31 20:04:05 +01:00
|
|
|
public:
|
|
|
|
explicit PublicRsaKeyWatchdog(ActorShared<> parent);
|
|
|
|
|
|
|
|
void add_public_rsa_key(std::shared_ptr<PublicRsaKeyShared> key);
|
|
|
|
|
|
|
|
private:
|
|
|
|
ActorShared<> parent_;
|
|
|
|
vector<std::shared_ptr<PublicRsaKeyShared>> keys_;
|
|
|
|
tl_object_ptr<telegram_api::cdnConfig> cdn_config_;
|
|
|
|
FloodControlStrict flood_control_;
|
|
|
|
bool has_query_{false};
|
2021-07-09 01:31:42 +02:00
|
|
|
string current_version_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-07-03 22:51:36 +02:00
|
|
|
void start_up() final;
|
|
|
|
void loop() final;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-07-03 22:51:36 +02:00
|
|
|
void on_result(NetQueryPtr net_query) final;
|
2018-12-31 20:04:05 +01:00
|
|
|
void sync(BufferSlice cdn_config_serialized);
|
|
|
|
void sync_key(std::shared_ptr<PublicRsaKeyShared> &key);
|
|
|
|
};
|
2018-06-25 23:10:53 +02:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
} // namespace td
|