Remove includes of SequenceDispatcher.h from headers.

This commit is contained in:
levlam 2022-02-01 19:34:14 +03:00
parent ad38f712e8
commit 02b99d0fbf
14 changed files with 75 additions and 70 deletions

View File

@ -18,7 +18,6 @@
#include "td/telegram/net/DcId.h" #include "td/telegram/net/DcId.h"
#include "td/telegram/net/NetActor.h" #include "td/telegram/net/NetActor.h"
#include "td/telegram/net/NetQueryCreator.h" #include "td/telegram/net/NetQueryCreator.h"
#include "td/telegram/SequenceDispatcher.h"
#include "td/telegram/Td.h" #include "td/telegram/Td.h"
#include "td/telegram/UpdatesManager.h" #include "td/telegram/UpdatesManager.h"
@ -56,10 +55,10 @@ class SetGameScoreActor final : public NetActorOnce {
} }
CHECK(input_user != nullptr); CHECK(input_user != nullptr);
auto query = G()->net_query_creator().create( send_query(G()->net_query_creator().create(
telegram_api::messages_setGameScore(flags, false /*ignored*/, false /*ignored*/, std::move(input_peer), telegram_api::messages_setGameScore(flags, false /*ignored*/, false /*ignored*/, std::move(input_peer),
message_id.get_server_message_id().get(), std::move(input_user), score), {sequence_dispatcher_id}); message_id.get_server_message_id().get(), std::move(input_user), score),
send_query(std::move(query)); {sequence_dispatcher_id}));
} }
void on_result(BufferSlice packet) final { void on_result(BufferSlice packet) final {

View File

@ -50,7 +50,6 @@
#include "td/telegram/ReplyMarkup.h" #include "td/telegram/ReplyMarkup.h"
#include "td/telegram/ReplyMarkup.hpp" #include "td/telegram/ReplyMarkup.hpp"
#include "td/telegram/SecretChatsManager.h" #include "td/telegram/SecretChatsManager.h"
#include "td/telegram/SequenceDispatcher.h"
#include "td/telegram/SponsoredMessageManager.h" #include "td/telegram/SponsoredMessageManager.h"
#include "td/telegram/Td.h" #include "td/telegram/Td.h"
#include "td/telegram/TdDb.h" #include "td/telegram/TdDb.h"
@ -338,7 +337,8 @@ class GetPinnedDialogsActor final : public NetActorOnce {
NetQueryRef send(FolderId folder_id, uint64 sequence_id) { NetQueryRef send(FolderId folder_id, uint64 sequence_id) {
folder_id_ = folder_id; folder_id_ = folder_id;
auto query = G()->net_query_creator().create(telegram_api::messages_getPinnedDialogs(folder_id.get()), {sequence_id}); auto query =
G()->net_query_creator().create(telegram_api::messages_getPinnedDialogs(folder_id.get()), {sequence_id});
auto result = query.get_weak(); auto result = query.get_weak();
send_query(std::move(query)); send_query(std::move(query));
return result; return result;
@ -791,10 +791,10 @@ class GetDialogListActor final : public NetActorOnce {
int32 flags = int32 flags =
telegram_api::messages_getDialogs::EXCLUDE_PINNED_MASK | telegram_api::messages_getDialogs::FOLDER_ID_MASK; telegram_api::messages_getDialogs::EXCLUDE_PINNED_MASK | telegram_api::messages_getDialogs::FOLDER_ID_MASK;
auto query = G()->net_query_creator().create( send_query(G()->net_query_creator().create(
telegram_api::messages_getDialogs(flags, false /*ignored*/, folder_id.get(), offset_date, telegram_api::messages_getDialogs(flags, false /*ignored*/, folder_id.get(), offset_date,
offset_message_id.get(), std::move(input_peer), limit, 0), {sequence_id}); offset_message_id.get(), std::move(input_peer), limit, 0),
send_query(std::move(query)); {sequence_id}));
} }
void on_result(BufferSlice packet) final { void on_result(BufferSlice packet) final {
@ -3090,9 +3090,9 @@ class SaveDefaultSendAsActor final : public NetActorOnce {
auto send_as_input_peer = td_->messages_manager_->get_input_peer(send_as_dialog_id, AccessRights::Read); auto send_as_input_peer = td_->messages_manager_->get_input_peer(send_as_dialog_id, AccessRights::Read);
CHECK(send_as_input_peer != nullptr); CHECK(send_as_input_peer != nullptr);
auto query = G()->net_query_creator().create( send_query(G()->net_query_creator().create(
telegram_api::messages_saveDefaultSendAs(std::move(input_peer), std::move(send_as_input_peer)), {sequence_dispatcher_id}); telegram_api::messages_saveDefaultSendAs(std::move(input_peer), std::move(send_as_input_peer)),
send_query(std::move(query)); {sequence_dispatcher_id}));
} }
void on_result(BufferSlice packet) final { void on_result(BufferSlice packet) final {
@ -3190,10 +3190,12 @@ class SendMessageActor final : public NetActorOnce {
flags |= MessagesManager::SEND_MESSAGE_FLAG_HAS_SEND_AS; flags |= MessagesManager::SEND_MESSAGE_FLAG_HAS_SEND_AS;
} }
auto query = G()->net_query_creator().create(telegram_api::messages_sendMessage( auto query = G()->net_query_creator().create(
flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, telegram_api::messages_sendMessage(
std::move(input_peer), reply_to_message_id.get_server_message_id().get(), text, random_id, flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
std::move(reply_markup), std::move(entities), schedule_date, std::move(as_input_peer)), {sequence_dispatcher_id}); std::move(input_peer), reply_to_message_id.get_server_message_id().get(), text, random_id,
std::move(reply_markup), std::move(entities), schedule_date, std::move(as_input_peer)),
{sequence_dispatcher_id});
if (G()->shared_config().get_option_boolean("use_quick_ack")) { if (G()->shared_config().get_option_boolean("use_quick_ack")) {
query->quick_ack_promise_ = PromiseCreator::lambda( query->quick_ack_promise_ = PromiseCreator::lambda(
[random_id](Unit) { [random_id](Unit) {
@ -3380,12 +3382,13 @@ class SendMultiMediaActor final : public NetActorOnce {
flags |= MessagesManager::SEND_MESSAGE_FLAG_HAS_SEND_AS; flags |= MessagesManager::SEND_MESSAGE_FLAG_HAS_SEND_AS;
} }
auto query = G()->net_query_creator().create(telegram_api::messages_sendMultiMedia(
flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, std::move(input_peer),
reply_to_message_id.get_server_message_id().get(), std::move(input_single_media), schedule_date,
std::move(as_input_peer)), {sequence_dispatcher_id});
// no quick ack, because file reference errors are very likely to happen // no quick ack, because file reference errors are very likely to happen
send_query(std::move(query)); send_query(G()->net_query_creator().create(
telegram_api::messages_sendMultiMedia(flags, false /*ignored*/, false /*ignored*/, false /*ignored*/,
false /*ignored*/, std::move(input_peer),
reply_to_message_id.get_server_message_id().get(),
std::move(input_single_media), schedule_date, std::move(as_input_peer)),
{sequence_dispatcher_id}));
} }
void on_result(BufferSlice packet) final { void on_result(BufferSlice packet) final {
@ -3497,10 +3500,12 @@ class SendMediaActor final : public NetActorOnce {
flags |= MessagesManager::SEND_MESSAGE_FLAG_HAS_SEND_AS; flags |= MessagesManager::SEND_MESSAGE_FLAG_HAS_SEND_AS;
} }
auto query = G()->net_query_creator().create(telegram_api::messages_sendMedia( auto query = G()->net_query_creator().create(
flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, std::move(input_peer), telegram_api::messages_sendMedia(
reply_to_message_id.get_server_message_id().get(), std::move(input_media), text, random_id, flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, std::move(input_peer),
std::move(reply_markup), std::move(entities), schedule_date, std::move(as_input_peer)), {sequence_dispatcher_id}); reply_to_message_id.get_server_message_id().get(), std::move(input_media), text, random_id,
std::move(reply_markup), std::move(entities), schedule_date, std::move(as_input_peer)),
{sequence_dispatcher_id});
if (G()->shared_config().get_option_boolean("use_quick_ack") && was_uploaded_) { if (G()->shared_config().get_option_boolean("use_quick_ack") && was_uploaded_) {
query->quick_ack_promise_ = PromiseCreator::lambda( query->quick_ack_promise_ = PromiseCreator::lambda(
[random_id](Unit) { [random_id](Unit) {
@ -3669,10 +3674,9 @@ class SendScheduledMessageActor final : public NetActorOnce {
} }
int32 server_message_id = message_id.get_scheduled_server_message_id().get(); int32 server_message_id = message_id.get_scheduled_server_message_id().get();
auto query = G()->net_query_creator().create( send_query(G()->net_query_creator().create(
telegram_api::messages_sendScheduledMessages(std::move(input_peer), {server_message_id}), {sequence_dispatcher_id}); telegram_api::messages_sendScheduledMessages(std::move(input_peer), {server_message_id}),
{sequence_dispatcher_id}));
send_query(std::move(query));
} }
void on_result(BufferSlice packet) final { void on_result(BufferSlice packet) final {
@ -3748,10 +3752,11 @@ class EditMessageActor final : public NetActorOnce {
int32 server_message_id = schedule_date != 0 ? message_id.get_scheduled_server_message_id().get() int32 server_message_id = schedule_date != 0 ? message_id.get_scheduled_server_message_id().get()
: message_id.get_server_message_id().get(); : message_id.get_server_message_id().get();
auto query = G()->net_query_creator().create(telegram_api::messages_editMessage( send_query(G()->net_query_creator().create(
flags, false /*ignored*/, std::move(input_peer), server_message_id, text, std::move(input_media), telegram_api::messages_editMessage(flags, false /*ignored*/, std::move(input_peer), server_message_id, text,
std::move(reply_markup), std::move(entities), schedule_date), {sequence_dispatcher_id}); std::move(input_media), std::move(reply_markup), std::move(entities),
send_query(std::move(query)); schedule_date),
{sequence_dispatcher_id}));
} }
void on_result(BufferSlice packet) final { void on_result(BufferSlice packet) final {
@ -3868,10 +3873,12 @@ class ForwardMessagesActor final : public NetActorOnce {
flags |= MessagesManager::SEND_MESSAGE_FLAG_HAS_SEND_AS; flags |= MessagesManager::SEND_MESSAGE_FLAG_HAS_SEND_AS;
} }
auto query = G()->net_query_creator().create(telegram_api::messages_forwardMessages( auto query = G()->net_query_creator().create(
flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, telegram_api::messages_forwardMessages(
false /*ignored*/, std::move(from_input_peer), MessagesManager::get_server_message_ids(message_ids), flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
std::move(random_ids), std::move(to_input_peer), schedule_date, std::move(as_input_peer)), {sequence_dispatcher_id}); false /*ignored*/, std::move(from_input_peer), MessagesManager::get_server_message_ids(message_ids),
std::move(random_ids), std::move(to_input_peer), schedule_date, std::move(as_input_peer)),
{sequence_dispatcher_id});
if (G()->shared_config().get_option_boolean("use_quick_ack")) { if (G()->shared_config().get_option_boolean("use_quick_ack")) {
query->quick_ack_promise_ = PromiseCreator::lambda( query->quick_ack_promise_ = PromiseCreator::lambda(
[random_ids = random_ids_](Unit) { [random_ids = random_ids_](Unit) {
@ -3965,9 +3972,8 @@ class SendScreenshotNotificationQuery final : public Td::ResultHandler {
auto input_peer = td_->messages_manager_->get_input_peer(dialog_id, AccessRights::Write); auto input_peer = td_->messages_manager_->get_input_peer(dialog_id, AccessRights::Write);
CHECK(input_peer != nullptr); CHECK(input_peer != nullptr);
auto query = G()->net_query_creator().create( send_query(G()->net_query_creator().create(
telegram_api::messages_sendScreenshotNotification(std::move(input_peer), 0, random_id)); telegram_api::messages_sendScreenshotNotification(std::move(input_peer), 0, random_id)));
send_query(std::move(query));
} }
void on_result(BufferSlice packet) final { void on_result(BufferSlice packet) final {
@ -19586,7 +19592,7 @@ void MessagesManager::save_dialog_draft_message_on_server(DialogId dialog_id) {
}); });
} }
// TODO do not send two queries simultaneously or use SequenceDispatcher // TODO do not send two queries simultaneously or use InvokeAfter
td_->create_handler<SaveDraftMessageQuery>(std::move(promise))->send(dialog_id, d->draft_message); td_->create_handler<SaveDraftMessageQuery>(std::move(promise))->send(dialog_id, d->draft_message);
} }
@ -20151,7 +20157,7 @@ void MessagesManager::update_dialog_notification_settings_on_server(DialogId dia
void MessagesManager::send_update_dialog_notification_settings_query(const Dialog *d, Promise<Unit> &&promise) { void MessagesManager::send_update_dialog_notification_settings_query(const Dialog *d, Promise<Unit> &&promise) {
CHECK(!td_->auth_manager_->is_bot()); CHECK(!td_->auth_manager_->is_bot());
CHECK(d != nullptr); CHECK(d != nullptr);
// TODO do not send two queries simultaneously or use SequenceDispatcher // TODO do not send two queries simultaneously or use InvokeAfter
td_->create_handler<UpdateDialogNotifySettingsQuery>(std::move(promise)) td_->create_handler<UpdateDialogNotifySettingsQuery>(std::move(promise))
->send(d->dialog_id, d->notification_settings); ->send(d->dialog_id, d->notification_settings);
} }
@ -32886,7 +32892,7 @@ void MessagesManager::set_dialog_folder_id_on_server(DialogId dialog_id, bool fr
}); });
} }
// TODO do not send two queries simultaneously or use SequenceDispatcher // TODO do not send two queries simultaneously or use InvokeAfter
td_->create_handler<EditPeerFoldersQuery>(std::move(promise))->send(dialog_id, d->folder_id); td_->create_handler<EditPeerFoldersQuery>(std::move(promise))->send(dialog_id, d->folder_id);
} }

View File

@ -567,8 +567,8 @@ class GetBankCardInfoQuery final : public Td::ResultHandler {
} }
void send(const string &bank_card_number) { void send(const string &bank_card_number) {
send_query(G()->net_query_creator().create(telegram_api::payments_getBankCardData(bank_card_number), send_query(G()->net_query_creator().create(telegram_api::payments_getBankCardData(bank_card_number), {},
{}, G()->get_webfile_dc_id())); G()->get_webfile_dc_id()));
} }
void on_result(BufferSlice packet) final { void on_result(BufferSlice packet) final {

View File

@ -19,7 +19,6 @@
#include "td/telegram/net/NetActor.h" #include "td/telegram/net/NetActor.h"
#include "td/telegram/PollId.hpp" #include "td/telegram/PollId.hpp"
#include "td/telegram/PollManager.hpp" #include "td/telegram/PollManager.hpp"
#include "td/telegram/SequenceDispatcher.h"
#include "td/telegram/StateManager.h" #include "td/telegram/StateManager.h"
#include "td/telegram/Td.h" #include "td/telegram/Td.h"
#include "td/telegram/TdDb.h" #include "td/telegram/TdDb.h"

View File

@ -70,7 +70,8 @@ SecretChatActor::SecretChatActor(int32 id, unique_ptr<Context> context, bool can
template <class T> template <class T>
NetQueryPtr SecretChatActor::create_net_query(QueryType type, const T &function) { NetQueryPtr SecretChatActor::create_net_query(QueryType type, const T &function) {
return context_->net_query_creator().create(UniqueId::next(UniqueId::Type::Default, static_cast<uint8>(type)), return context_->net_query_creator().create(UniqueId::next(UniqueId::Type::Default, static_cast<uint8>(type)),
function, {}, DcId::main(), NetQuery::Type::Common, NetQuery::AuthFlag::On); function, {}, DcId::main(), NetQuery::Type::Common,
NetQuery::AuthFlag::On);
} }
void SecretChatActor::update_chat(telegram_api::object_ptr<telegram_api::EncryptedChat> chat) { void SecretChatActor::update_chat(telegram_api::object_ptr<telegram_api::EncryptedChat> chat) {

View File

@ -282,7 +282,7 @@ void MultiSequenceDispatcherOld::ready_to_close() {
} }
} }
class MultiSequenceDispatcherNewImpl final : public MultiSequenceDispatcherNew { class MultiSequenceDispatcherImpl final : public MultiSequenceDispatcher {
public: public:
void send(NetQueryPtr query) final { void send(NetQueryPtr query) final {
auto callback = query->move_callback(); auto callback = query->move_callback();
@ -371,7 +371,7 @@ class MultiSequenceDispatcherNewImpl final : public MultiSequenceDispatcherNew {
void try_resend(TaskId task_id) { void try_resend(TaskId task_id) {
auto &node = *scheduler_.get_task_extra(task_id); auto &node = *scheduler_.get_task_extra(task_id);
auto promise = promise_send_closure(actor_shared(this, task_id), &MultiSequenceDispatcherNewImpl::on_resend); auto promise = promise_send_closure(actor_shared(this, task_id), &MultiSequenceDispatcherImpl::on_resend);
send_closure(node.callback, &NetQueryCallback::on_result_resendable, std::move(node.net_query), std::move(promise)); send_closure(node.callback, &NetQueryCallback::on_result_resendable, std::move(node.net_query), std::move(promise));
} }
@ -435,8 +435,8 @@ class MultiSequenceDispatcherNewImpl final : public MultiSequenceDispatcherNew {
} }
}; };
ActorOwn<MultiSequenceDispatcherNew> MultiSequenceDispatcherNew::create(Slice name) { ActorOwn<MultiSequenceDispatcher> MultiSequenceDispatcher::create(Slice name) {
return ActorOwn<MultiSequenceDispatcherNew>(create_actor<MultiSequenceDispatcherNewImpl>(name)); return ActorOwn<MultiSequenceDispatcher>(create_actor<MultiSequenceDispatcherImpl>(name));
} }
} // namespace td } // namespace td

View File

@ -94,12 +94,10 @@ class MultiSequenceDispatcherOld final : public SequenceDispatcher::Parent {
using ChainId = uint64; using ChainId = uint64;
using ChainIds = vector<ChainId>; using ChainIds = vector<ChainId>;
class MultiSequenceDispatcherNew : public NetQueryCallback { class MultiSequenceDispatcher : public NetQueryCallback {
public: public:
virtual void send(NetQueryPtr query) = 0; virtual void send(NetQueryPtr query) = 0;
static ActorOwn<MultiSequenceDispatcherNew> create(Slice name); static ActorOwn<MultiSequenceDispatcher> create(Slice name);
}; };
using MultiSequenceDispatcher = MultiSequenceDispatcherNew;
} // namespace td } // namespace td

View File

@ -276,8 +276,8 @@ Result<std::pair<NetQueryPtr, bool>> FileDownloader::start_part(Part part, int32
auto query = telegram_api::upload_reuploadCdnFile(BufferSlice(cdn_file_token_), BufferSlice(it->second)); auto query = telegram_api::upload_reuploadCdnFile(BufferSlice(cdn_file_token_), BufferSlice(it->second));
LOG(DEBUG) << part.id << " " << to_string(query); LOG(DEBUG) << part.id << " " << to_string(query);
net_query = G()->net_query_creator().create( net_query = G()->net_query_creator().create(
UniqueId::next(UniqueId::Type::Default, static_cast<uint8>(QueryType::ReuploadCDN)), query, UniqueId::next(UniqueId::Type::Default, static_cast<uint8>(QueryType::ReuploadCDN)), query, {},
{}, remote_.get_dc_id(), net_query_type, NetQuery::AuthFlag::On); remote_.get_dc_id(), net_query_type, NetQuery::AuthFlag::On);
cdn_part_reupload_token_.erase(it); cdn_part_reupload_token_.erase(it);
} }
} }

View File

@ -200,8 +200,8 @@ class MapDownloadGenerateActor final : public FileGenerateActor {
LOG(INFO) << "Download " << conversion_; LOG(INFO) << "Download " << conversion_;
auto query = auto query =
G()->net_query_creator().create(telegram_api::upload_getWebFile(r_input_web_file.move_as_ok(), 0, 1 << 20), G()->net_query_creator().create(telegram_api::upload_getWebFile(r_input_web_file.move_as_ok(), 0, 1 << 20), {},
{}, G()->get_webfile_dc_id(), NetQuery::Type::DownloadSmall); G()->get_webfile_dc_id(), NetQuery::Type::DownloadSmall);
G()->net_query_dispatcher().dispatch_with_callback(std::move(query), {net_callback_.get(), 0}); G()->net_query_dispatcher().dispatch_with_callback(std::move(query), {net_callback_.get(), 0});
} }

View File

@ -25,12 +25,13 @@ NetQueryCreator::NetQueryCreator(std::shared_ptr<NetQueryStats> net_query_stats)
object_pool_.set_check_empty(true); object_pool_.set_check_empty(true);
} }
NetQueryPtr NetQueryCreator::create(const telegram_api::Function &function, std::vector<uint64> chains, DcId dc_id, NetQuery::Type type) { NetQueryPtr NetQueryCreator::create(const telegram_api::Function &function, std::vector<uint64> chains, DcId dc_id,
NetQuery::Type type) {
return create(UniqueId::next(), function, std::move(chains), dc_id, type, NetQuery::AuthFlag::On); return create(UniqueId::next(), function, std::move(chains), dc_id, type, NetQuery::AuthFlag::On);
} }
NetQueryPtr NetQueryCreator::create(uint64 id, const telegram_api::Function &function, std::vector<uint64> chains, DcId dc_id, NetQuery::Type type, NetQueryPtr NetQueryCreator::create(uint64 id, const telegram_api::Function &function, std::vector<uint64> chains,
NetQuery::AuthFlag auth_flag) { DcId dc_id, NetQuery::Type type, NetQuery::AuthFlag auth_flag) {
LOG(INFO) << "Create query " << to_string(function); LOG(INFO) << "Create query " << to_string(function);
auto storer = DefaultStorer<telegram_api::Function>(function); auto storer = DefaultStorer<telegram_api::Function>(function);
BufferSlice slice(storer.size()); BufferSlice slice(storer.size());

View File

@ -36,8 +36,8 @@ class NetQueryCreator {
return create(UniqueId::next(), function, {}, dc_id, NetQuery::Type::Common, NetQuery::AuthFlag::Off); return create(UniqueId::next(), function, {}, dc_id, NetQuery::Type::Common, NetQuery::AuthFlag::Off);
} }
NetQueryPtr create(uint64 id, const telegram_api::Function &function, std::vector<uint64> chains, DcId dc_id, NetQuery::Type type, NetQueryPtr create(uint64 id, const telegram_api::Function &function, std::vector<uint64> chains, DcId dc_id,
NetQuery::AuthFlag auth_flag); NetQuery::Type type, NetQuery::AuthFlag auth_flag);
private: private:
std::shared_ptr<NetQueryStats> net_query_stats_; std::shared_ptr<NetQueryStats> net_query_stats_;

View File

@ -15,6 +15,7 @@
#include "td/telegram/net/PublicRsaKeyShared.h" #include "td/telegram/net/PublicRsaKeyShared.h"
#include "td/telegram/net/PublicRsaKeyWatchdog.h" #include "td/telegram/net/PublicRsaKeyWatchdog.h"
#include "td/telegram/net/SessionMultiProxy.h" #include "td/telegram/net/SessionMultiProxy.h"
#include "td/telegram/SequenceDispatcher.h"
#include "td/telegram/Td.h" #include "td/telegram/Td.h"
#include "td/telegram/TdDb.h" #include "td/telegram/TdDb.h"
#include "td/telegram/telegram_api.h" #include "td/telegram/telegram_api.h"
@ -49,9 +50,9 @@ void NetQueryDispatcher::dispatch(NetQueryPtr net_query) {
if (G()->shared_config().get_option_boolean("test_flood_wait")) { if (G()->shared_config().get_option_boolean("test_flood_wait")) {
net_query->set_error(Status::Error(429, "Too Many Requests: retry after 10")); net_query->set_error(Status::Error(429, "Too Many Requests: retry after 10"));
return complete_net_query(std::move(net_query)); return complete_net_query(std::move(net_query));
// if (net_query->is_ok() && net_query->tl_constructor() == 0x0d9d75a4) { // if (net_query->is_ok() && net_query->tl_constructor() == 0x0d9d75a4) {
// net_query->set_error(Status::Error(420, "FLOOD_WAIT_10")); // net_query->set_error(Status::Error(420, "FLOOD_WAIT_10"));
// } // }
} }
if (net_query->tl_constructor() == telegram_api::account_getPassword::ID && false) { if (net_query->tl_constructor() == telegram_api::account_getPassword::ID && false) {
net_query->set_error(Status::Error(429, "Too Many Requests: retry after 10")); net_query->set_error(Status::Error(429, "Too Many Requests: retry after 10"));

View File

@ -15,7 +15,6 @@
#include "td/utils/common.h" #include "td/utils/common.h"
#include "td/utils/ScopeGuard.h" #include "td/utils/ScopeGuard.h"
#include "td/utils/Status.h" #include "td/utils/Status.h"
#include "td/telegram/SequenceDispatcher.h"
#include <array> #include <array>
#include <atomic> #include <atomic>
@ -26,6 +25,7 @@
namespace td { namespace td {
class DcAuthManager; class DcAuthManager;
class MultiSequenceDispatcher;
class NetQueryDelayer; class NetQueryDelayer;
class PublicRsaKeyShared; class PublicRsaKeyShared;
class PublicRsaKeyWatchdog; class PublicRsaKeyWatchdog;

View File

@ -1214,8 +1214,8 @@ bool Session::connection_send_check_main_key(ConnectionInfo *info) {
LOG(INFO) << "Check main key"; LOG(INFO) << "Check main key";
being_checked_main_auth_key_id_ = key_id; being_checked_main_auth_key_id_ = key_id;
last_check_query_id_ = UniqueId::next(UniqueId::BindKey); last_check_query_id_ = UniqueId::next(UniqueId::BindKey);
NetQueryPtr query = G()->net_query_creator().create(last_check_query_id_, telegram_api::help_getNearestDc(), NetQueryPtr query = G()->net_query_creator().create(last_check_query_id_, telegram_api::help_getNearestDc(), {},
{}, DcId::main(), NetQuery::Type::Common, NetQuery::AuthFlag::On); DcId::main(), NetQuery::Type::Common, NetQuery::AuthFlag::On);
query->dispatch_ttl_ = 0; query->dispatch_ttl_ = 0;
query->set_callback(actor_shared(this)); query->set_callback(actor_shared(this));
connection_send_query(info, std::move(query)); connection_send_query(info, std::move(query));