Always list actor_id first in lambda capture.
This commit is contained in:
parent
3b28485a3f
commit
b9473decc2
@ -295,9 +295,9 @@ void FileReferenceManager::send_query(Destination dest, FileSourceId file_source
|
|||||||
auto &node = add_node(dest.node_id);
|
auto &node = add_node(dest.node_id);
|
||||||
node.query->active_queries++;
|
node.query->active_queries++;
|
||||||
|
|
||||||
auto promise = PromiseCreator::lambda([dest, file_source_id, actor_id = actor_id(this),
|
auto promise = PromiseCreator::lambda([actor_id = actor_id(this), file_manager_actor_id = G()->file_manager(), dest,
|
||||||
file_manager_actor_id = G()->file_manager()](Result<Unit> result) {
|
file_source_id](Result<Unit> result) {
|
||||||
auto new_promise = PromiseCreator::lambda([dest, file_source_id, actor_id](Result<Unit> result) {
|
auto new_promise = PromiseCreator::lambda([actor_id, dest, file_source_id](Result<Unit> result) {
|
||||||
Status status;
|
Status status;
|
||||||
if (result.is_error()) {
|
if (result.is_error()) {
|
||||||
status = result.move_as_error();
|
status = result.move_as_error();
|
||||||
|
@ -23442,9 +23442,10 @@ void MessagesManager::get_history_from_the_end_impl(const Dialog *d, bool from_d
|
|||||||
db_query.from_message_id = MessageId::max();
|
db_query.from_message_id = MessageId::max();
|
||||||
db_query.limit = limit;
|
db_query.limit = limit;
|
||||||
G()->td_db()->get_message_db_async()->get_messages(
|
G()->td_db()->get_message_db_async()->get_messages(
|
||||||
db_query, PromiseCreator::lambda([dialog_id, old_last_database_message_id = d->last_database_message_id,
|
db_query,
|
||||||
only_local, limit, actor_id = actor_id(this), promise = std::move(promise)](
|
PromiseCreator::lambda([actor_id = actor_id(this), dialog_id,
|
||||||
vector<MessageDbDialogMessage> messages) mutable {
|
old_last_database_message_id = d->last_database_message_id, only_local, limit,
|
||||||
|
promise = std::move(promise)](vector<MessageDbDialogMessage> messages) mutable {
|
||||||
send_closure(actor_id, &MessagesManager::on_get_history_from_database, dialog_id, MessageId::max(),
|
send_closure(actor_id, &MessagesManager::on_get_history_from_database, dialog_id, MessageId::max(),
|
||||||
old_last_database_message_id, 0, limit, true, only_local, std::move(messages),
|
old_last_database_message_id, 0, limit, true, only_local, std::move(messages),
|
||||||
std::move(promise));
|
std::move(promise));
|
||||||
@ -23497,8 +23498,8 @@ void MessagesManager::get_history_impl(const Dialog *d, MessageId from_message_i
|
|||||||
db_query.limit = limit;
|
db_query.limit = limit;
|
||||||
G()->td_db()->get_message_db_async()->get_messages(
|
G()->td_db()->get_message_db_async()->get_messages(
|
||||||
db_query,
|
db_query,
|
||||||
PromiseCreator::lambda([dialog_id, from_message_id, old_last_database_message_id = d->last_database_message_id,
|
PromiseCreator::lambda([actor_id = actor_id(this), dialog_id, from_message_id,
|
||||||
offset, limit, only_local, actor_id = actor_id(this),
|
old_last_database_message_id = d->last_database_message_id, offset, limit, only_local,
|
||||||
promise = std::move(promise)](vector<MessageDbDialogMessage> messages) mutable {
|
promise = std::move(promise)](vector<MessageDbDialogMessage> messages) mutable {
|
||||||
send_closure(actor_id, &MessagesManager::on_get_history_from_database, dialog_id, from_message_id,
|
send_closure(actor_id, &MessagesManager::on_get_history_from_database, dialog_id, from_message_id,
|
||||||
old_last_database_message_id, offset, limit, false, only_local, std::move(messages),
|
old_last_database_message_id, offset, limit, false, only_local, std::move(messages),
|
||||||
@ -23647,7 +23648,7 @@ void MessagesManager::load_dialog_scheduled_messages(DialogId dialog_id, bool fr
|
|||||||
if (queries.size() == 1) {
|
if (queries.size() == 1) {
|
||||||
G()->td_db()->get_message_db_async()->get_scheduled_messages(
|
G()->td_db()->get_message_db_async()->get_scheduled_messages(
|
||||||
dialog_id, 1000,
|
dialog_id, 1000,
|
||||||
PromiseCreator::lambda([dialog_id, actor_id = actor_id(this)](vector<MessageDbDialogMessage> messages) {
|
PromiseCreator::lambda([actor_id = actor_id(this), dialog_id](vector<MessageDbDialogMessage> messages) {
|
||||||
send_closure(actor_id, &MessagesManager::on_get_scheduled_messages_from_database, dialog_id,
|
send_closure(actor_id, &MessagesManager::on_get_scheduled_messages_from_database, dialog_id,
|
||||||
std::move(messages));
|
std::move(messages));
|
||||||
}));
|
}));
|
||||||
@ -29736,8 +29737,8 @@ void MessagesManager::remove_message_notification(DialogId dialog_id, Notificati
|
|||||||
if (G()->use_message_database()) {
|
if (G()->use_message_database()) {
|
||||||
G()->td_db()->get_message_db_async()->get_messages_from_notification_id(
|
G()->td_db()->get_message_db_async()->get_messages_from_notification_id(
|
||||||
dialog_id, NotificationId(notification_id.get() + 1), 1,
|
dialog_id, NotificationId(notification_id.get() + 1), 1,
|
||||||
PromiseCreator::lambda([dialog_id, from_mentions, notification_id,
|
PromiseCreator::lambda([actor_id = actor_id(this), dialog_id, from_mentions,
|
||||||
actor_id = actor_id(this)](vector<MessageDbDialogMessage> result) {
|
notification_id](vector<MessageDbDialogMessage> result) {
|
||||||
send_closure(actor_id, &MessagesManager::do_remove_message_notification, dialog_id, from_mentions,
|
send_closure(actor_id, &MessagesManager::do_remove_message_notification, dialog_id, from_mentions,
|
||||||
notification_id, std::move(result));
|
notification_id, std::move(result));
|
||||||
}));
|
}));
|
||||||
|
@ -244,8 +244,8 @@ void PasswordManager::do_get_secure_secret(bool allow_recursive, string password
|
|||||||
return promise.set_error(Status::Error(400, "PASSWORD_HASH_INVALID"));
|
return promise.set_error(Status::Error(400, "PASSWORD_HASH_INVALID"));
|
||||||
}
|
}
|
||||||
get_full_state(
|
get_full_state(
|
||||||
password, PromiseCreator::lambda([password, allow_recursive, promise = std::move(promise),
|
password, PromiseCreator::lambda([actor_id = actor_id(this), password, allow_recursive,
|
||||||
actor_id = actor_id(this)](Result<PasswordFullState> r_state) mutable {
|
promise = std::move(promise)](Result<PasswordFullState> r_state) mutable {
|
||||||
if (r_state.is_error()) {
|
if (r_state.is_error()) {
|
||||||
return promise.set_error(r_state.move_as_error());
|
return promise.set_error(r_state.move_as_error());
|
||||||
}
|
}
|
||||||
@ -262,7 +262,7 @@ void PasswordManager::do_get_secure_secret(bool allow_recursive, string password
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto new_promise =
|
auto new_promise =
|
||||||
PromiseCreator::lambda([password, promise = std::move(promise), actor_id](Result<bool> r_ok) mutable {
|
PromiseCreator::lambda([actor_id, password, promise = std::move(promise)](Result<bool> r_ok) mutable {
|
||||||
if (r_ok.is_error()) {
|
if (r_ok.is_error()) {
|
||||||
return promise.set_error(r_ok.move_as_error());
|
return promise.set_error(r_ok.move_as_error());
|
||||||
}
|
}
|
||||||
@ -302,8 +302,8 @@ void PasswordManager::create_temp_password(string password, int32 timeout, Promi
|
|||||||
send_closure(actor_id, &PasswordManager::on_finish_create_temp_password, std::move(result), false);
|
send_closure(actor_id, &PasswordManager::on_finish_create_temp_password, std::move(result), false);
|
||||||
});
|
});
|
||||||
|
|
||||||
do_get_state(PromiseCreator::lambda([password = std::move(password), timeout, promise = std::move(new_promise),
|
do_get_state(PromiseCreator::lambda([actor_id = actor_id(this), password = std::move(password), timeout,
|
||||||
actor_id = actor_id(this)](Result<PasswordState> r_state) mutable {
|
promise = std::move(new_promise)](Result<PasswordState> r_state) mutable {
|
||||||
if (r_state.is_error()) {
|
if (r_state.is_error()) {
|
||||||
return promise.set_error(r_state.move_as_error());
|
return promise.set_error(r_state.move_as_error());
|
||||||
}
|
}
|
||||||
@ -350,8 +350,8 @@ void PasswordManager::get_full_state(string password, Promise<PasswordFullState>
|
|||||||
send_closure(G()->config_manager(), &ConfigManager::hide_suggested_action,
|
send_closure(G()->config_manager(), &ConfigManager::hide_suggested_action,
|
||||||
SuggestedAction{SuggestedAction::Type::CheckPassword});
|
SuggestedAction{SuggestedAction::Type::CheckPassword});
|
||||||
|
|
||||||
do_get_state(PromiseCreator::lambda([password = std::move(password), promise = std::move(promise),
|
do_get_state(PromiseCreator::lambda([actor_id = actor_id(this), password = std::move(password),
|
||||||
actor_id = actor_id(this)](Result<PasswordState> r_state) mutable {
|
promise = std::move(promise)](Result<PasswordState> r_state) mutable {
|
||||||
if (r_state.is_error()) {
|
if (r_state.is_error()) {
|
||||||
return promise.set_error(r_state.move_as_error());
|
return promise.set_error(r_state.move_as_error());
|
||||||
}
|
}
|
||||||
|
@ -919,7 +919,7 @@ void PollManager::do_set_poll_answer(PollId poll_id, FullMessageId full_message_
|
|||||||
notify_on_poll_update(poll_id);
|
notify_on_poll_update(poll_id);
|
||||||
|
|
||||||
auto query_promise = PromiseCreator::lambda(
|
auto query_promise = PromiseCreator::lambda(
|
||||||
[poll_id, generation, actor_id = actor_id(this)](Result<tl_object_ptr<telegram_api::Updates>> &&result) {
|
[actor_id = actor_id(this), poll_id, generation](Result<tl_object_ptr<telegram_api::Updates>> &&result) {
|
||||||
send_closure(actor_id, &PollManager::on_set_poll_answer, poll_id, generation, std::move(result));
|
send_closure(actor_id, &PollManager::on_set_poll_answer, poll_id, generation, std::move(result));
|
||||||
});
|
});
|
||||||
td_->create_handler<SendVoteQuery>(std::move(query_promise))
|
td_->create_handler<SendVoteQuery>(std::move(query_promise))
|
||||||
@ -1327,7 +1327,7 @@ void PollManager::on_update_poll_timeout(PollId poll_id) {
|
|||||||
|
|
||||||
auto full_message_id = server_poll_messages_[poll_id].get_random();
|
auto full_message_id = server_poll_messages_[poll_id].get_random();
|
||||||
LOG(INFO) << "Fetching results of " << poll_id << " from " << full_message_id;
|
LOG(INFO) << "Fetching results of " << poll_id << " from " << full_message_id;
|
||||||
auto query_promise = PromiseCreator::lambda([poll_id, generation = current_generation_, actor_id = actor_id(this)](
|
auto query_promise = PromiseCreator::lambda([actor_id = actor_id(this), poll_id, generation = current_generation_](
|
||||||
Result<tl_object_ptr<telegram_api::Updates>> &&result) {
|
Result<tl_object_ptr<telegram_api::Updates>> &&result) {
|
||||||
send_closure(actor_id, &PollManager::on_get_poll_results, poll_id, generation, std::move(result));
|
send_closure(actor_id, &PollManager::on_get_poll_results, poll_id, generation, std::move(result));
|
||||||
});
|
});
|
||||||
|
@ -4080,7 +4080,7 @@ void Td::answer_ok_query(uint64 id, Status status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Promise<Unit> Td::create_ok_request_promise(uint64 id) {
|
Promise<Unit> Td::create_ok_request_promise(uint64 id) {
|
||||||
return PromiseCreator::lambda([id = id, actor_id = actor_id(this)](Result<Unit> result) {
|
return PromiseCreator::lambda([actor_id = actor_id(this), id](Result<Unit> result) {
|
||||||
if (result.is_error()) {
|
if (result.is_error()) {
|
||||||
send_closure(actor_id, &Td::send_error, id, result.move_as_error());
|
send_closure(actor_id, &Td::send_error, id, result.move_as_error());
|
||||||
} else {
|
} else {
|
||||||
@ -8611,7 +8611,7 @@ void Td::on_request(uint64 id, td_api::assignGooglePlayTransaction &request) {
|
|||||||
void Td::on_request(uint64 id, td_api::acceptTermsOfService &request) {
|
void Td::on_request(uint64 id, td_api::acceptTermsOfService &request) {
|
||||||
CHECK_IS_USER();
|
CHECK_IS_USER();
|
||||||
CLEAN_INPUT_STRING(request.terms_of_service_id_);
|
CLEAN_INPUT_STRING(request.terms_of_service_id_);
|
||||||
auto promise = PromiseCreator::lambda([id = id, actor_id = actor_id(this)](Result<> result) {
|
auto promise = PromiseCreator::lambda([actor_id = actor_id(this), id](Result<> result) {
|
||||||
if (result.is_error()) {
|
if (result.is_error()) {
|
||||||
send_closure(actor_id, &Td::send_error, id, result.move_as_error());
|
send_closure(actor_id, &Td::send_error, id, result.move_as_error());
|
||||||
} else {
|
} else {
|
||||||
|
@ -394,7 +394,7 @@ class Td final : public Actor {
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
Promise<T> create_request_promise(uint64 id) {
|
Promise<T> create_request_promise(uint64 id) {
|
||||||
return PromiseCreator::lambda([id = id, actor_id = actor_id(this)](Result<T> r_state) {
|
return PromiseCreator::lambda([actor_id = actor_id(this), id](Result<T> r_state) {
|
||||||
if (r_state.is_error()) {
|
if (r_state.is_error()) {
|
||||||
send_closure(actor_id, &Td::send_error, id, r_state.move_as_error());
|
send_closure(actor_id, &Td::send_error, id, r_state.move_as_error());
|
||||||
} else {
|
} else {
|
||||||
|
@ -2481,7 +2481,7 @@ void FileManager::run_download(FileNodePtr node, bool force_update_priority) {
|
|||||||
QueryId query_id = queries_container_.create(Query{file_id, Query::Type::DownloadReloadDialog});
|
QueryId query_id = queries_container_.create(Query{file_id, Query::Type::DownloadReloadDialog});
|
||||||
node->download_id_ = query_id;
|
node->download_id_ = query_id;
|
||||||
context_->reload_photo(file_view.remote_location().get_source(),
|
context_->reload_photo(file_view.remote_location().get_source(),
|
||||||
PromiseCreator::lambda([query_id, actor_id = actor_id(this), file_id](Result<Unit> res) {
|
PromiseCreator::lambda([actor_id = actor_id(this), query_id, file_id](Result<Unit> res) {
|
||||||
Status error;
|
Status error;
|
||||||
if (res.is_ok()) {
|
if (res.is_ok()) {
|
||||||
error = Status::Error("FILE_DOWNLOAD_ID_INVALID");
|
error = Status::Error("FILE_DOWNLOAD_ID_INVALID");
|
||||||
@ -2507,7 +2507,7 @@ void FileManager::run_download(FileNodePtr node, bool force_update_priority) {
|
|||||||
node->download_was_update_file_reference_ = true;
|
node->download_was_update_file_reference_ = true;
|
||||||
|
|
||||||
context_->repair_file_reference(
|
context_->repair_file_reference(
|
||||||
file_id, PromiseCreator::lambda([query_id, actor_id = actor_id(this), file_id](Result<Unit> res) {
|
file_id, PromiseCreator::lambda([actor_id = actor_id(this), query_id, file_id](Result<Unit> res) {
|
||||||
Status error;
|
Status error;
|
||||||
if (res.is_ok()) {
|
if (res.is_ok()) {
|
||||||
error = Status::Error("FILE_DOWNLOAD_RESTART_WITH_FILE_REFERENCE");
|
error = Status::Error("FILE_DOWNLOAD_RESTART_WITH_FILE_REFERENCE");
|
||||||
@ -3011,7 +3011,7 @@ void FileManager::run_upload(FileNodePtr node, vector<int> bad_parts) {
|
|||||||
node->upload_was_update_file_reference_ = true;
|
node->upload_was_update_file_reference_ = true;
|
||||||
|
|
||||||
context_->repair_file_reference(node->main_file_id_,
|
context_->repair_file_reference(node->main_file_id_,
|
||||||
PromiseCreator::lambda([query_id, actor_id = actor_id(this)](Result<Unit> res) {
|
PromiseCreator::lambda([actor_id = actor_id(this), query_id](Result<Unit> res) {
|
||||||
send_closure(actor_id, &FileManager::on_error, query_id,
|
send_closure(actor_id, &FileManager::on_error, query_id,
|
||||||
Status::Error("FILE_UPLOAD_RESTART_WITH_FILE_REFERENCE"));
|
Status::Error("FILE_UPLOAD_RESTART_WITH_FILE_REFERENCE"));
|
||||||
}));
|
}));
|
||||||
|
@ -343,7 +343,7 @@ void ConnectionCreator::ping_proxy_resolved(int32 proxy_id, IPAddress ip_address
|
|||||||
auto socket_fd = r_socket_fd.move_as_ok();
|
auto socket_fd = r_socket_fd.move_as_ok();
|
||||||
|
|
||||||
auto connection_promise = PromiseCreator::lambda(
|
auto connection_promise = PromiseCreator::lambda(
|
||||||
[ip_address, promise = std::move(promise), actor_id = actor_id(this), transport_type = extra.transport_type,
|
[actor_id = actor_id(this), ip_address, promise = std::move(promise), transport_type = extra.transport_type,
|
||||||
debug_str = extra.debug_str](Result<ConnectionData> r_connection_data) mutable {
|
debug_str = extra.debug_str](Result<ConnectionData> r_connection_data) mutable {
|
||||||
if (r_connection_data.is_error()) {
|
if (r_connection_data.is_error()) {
|
||||||
return promise.set_error(Status::Error(400, r_connection_data.error().public_message()));
|
return promise.set_error(Status::Error(400, r_connection_data.error().public_message()));
|
||||||
@ -619,7 +619,7 @@ void ConnectionCreator::request_raw_connection_by_ip(IPAddress ip_address, mtpro
|
|||||||
}
|
}
|
||||||
auto socket_fd = r_socket_fd.move_as_ok();
|
auto socket_fd = r_socket_fd.move_as_ok();
|
||||||
|
|
||||||
auto connection_promise = PromiseCreator::lambda([promise = std::move(promise), actor_id = actor_id(this),
|
auto connection_promise = PromiseCreator::lambda([actor_id = actor_id(this), promise = std::move(promise),
|
||||||
transport_type, network_generation = network_generation_,
|
transport_type, network_generation = network_generation_,
|
||||||
ip_address](Result<ConnectionData> r_connection_data) mutable {
|
ip_address](Result<ConnectionData> r_connection_data) mutable {
|
||||||
if (r_connection_data.is_error()) {
|
if (r_connection_data.is_error()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user