diff --git a/benchmark/bench_actor.cpp b/benchmark/bench_actor.cpp index bb6237ca9..66f2e72e3 100644 --- a/benchmark/bench_actor.cpp +++ b/benchmark/bench_actor.cpp @@ -261,8 +261,9 @@ class QueryBench final : public td::Benchmark { send_lambda(client_, [&] { val = n_ * n_; }); } else if (type == 5) { send_closure(client_, &ClientActor::f_promise, - td::PromiseCreator::lambda( - [id = actor_id(this), n = n_](td::Unit) { send_closure(id, &ServerActor::result, n * n); })); + td::PromiseCreator::lambda([actor_id = actor_id(this), n = n_](td::Unit) { + send_closure(actor_id, &ServerActor::result, n * n); + })); return; } } diff --git a/td/telegram/ConfigManager.cpp b/td/telegram/ConfigManager.cpp index 660480f4a..47f595cc0 100644 --- a/td/telegram/ConfigManager.cpp +++ b/td/telegram/ConfigManager.cpp @@ -812,10 +812,9 @@ class ConfigRecoverer final : public Actor { if (need_simple_config) { ref_cnt_++; VLOG(config_recoverer) << "Ask simple config with turn " << simple_config_turn_; - auto promise = - PromiseCreator::lambda([actor_id = actor_shared(this)](Result r_simple_config) { - send_closure(actor_id, &ConfigRecoverer::on_simple_config, std::move(r_simple_config), false); - }); + auto promise = PromiseCreator::lambda([self = actor_shared(this)](Result r_simple_config) { + send_closure(self, &ConfigRecoverer::on_simple_config, std::move(r_simple_config), false); + }); auto get_simple_config = [&] { switch (simple_config_turn_ % 10) { case 6: diff --git a/td/telegram/DownloadManager.cpp b/td/telegram/DownloadManager.cpp index 1a7d9bf40..a56fee2bd 100644 --- a/td/telegram/DownloadManager.cpp +++ b/td/telegram/DownloadManager.cpp @@ -508,9 +508,9 @@ class DownloadManagerImpl final : public DownloadManager { const auto &file_info = *it.second; send_closure(G()->file_reference_manager(), &FileReferenceManager::get_file_search_text, file_info.file_source_id, callback_->get_file_view(file_info.file_id).get_unique_file_id(), - [self = actor_id(this), promise = load_search_text_multipromise_.get_promise(), + [actor_id = actor_id(this), promise = load_search_text_multipromise_.get_promise(), download_id = it.first](Result r_search_text) mutable { - send_closure(self, &DownloadManagerImpl::add_download_to_hints, download_id, + send_closure(actor_id, &DownloadManagerImpl::add_download_to_hints, download_id, std::move(r_search_text), std::move(promise)); }); } diff --git a/td/telegram/SecureManager.cpp b/td/telegram/SecureManager.cpp index 8a29bdf36..c26e1cbae 100644 --- a/td/telegram/SecureManager.cpp +++ b/td/telegram/SecureManager.cpp @@ -1050,10 +1050,10 @@ void SecureManager::get_passport_authorization_form_available_elements(int32 aut refcnt_++; send_closure(G()->password_manager(), &PasswordManager::get_secure_secret, password, - PromiseCreator::lambda([actor_id = actor_shared(this), authorization_form_id, + PromiseCreator::lambda([self = actor_shared(this), authorization_form_id, promise = std::move(promise)](Result r_secret) mutable { - send_closure(actor_id, &SecureManager::on_get_passport_authorization_form_secret, - authorization_form_id, std::move(promise), std::move(r_secret)); + send_closure(self, &SecureManager::on_get_passport_authorization_form_secret, authorization_form_id, + std::move(promise), std::move(r_secret)); })); } diff --git a/td/telegram/net/Session.cpp b/td/telegram/net/Session.cpp index 9ddab614d..728da8ea1 100644 --- a/td/telegram/net/Session.cpp +++ b/td/telegram/net/Session.cpp @@ -1348,14 +1348,14 @@ void Session::create_gen_auth_key_actor(HandshakeId handshake_id) { PSLICE() << get_name() << "::GenAuthKey", get_name(), std::move(info.handshake_), td::make_unique(DhCache::instance(), shared_auth_data_->public_rsa_key()), PromiseCreator::lambda( - [self = actor_id(this), guard = callback_](Result> r_connection) { + [actor_id = actor_id(this), guard = callback_](Result> r_connection) { if (r_connection.is_error()) { if (r_connection.error().code() != 1) { LOG(WARNING) << "Failed to open connection: " << r_connection.error(); } return; } - send_closure(self, &Session::connection_add, r_connection.move_as_ok()); + send_closure(actor_id, &Session::connection_add, r_connection.move_as_ok()); }), PromiseCreator::lambda([self = actor_shared(this, handshake_id + 1), handshake_perf = PerfWarningTimer("handshake", 1000.1), diff --git a/test/mtproto.cpp b/test/mtproto.cpp index a729a8d28..91c82abe5 100644 --- a/test/mtproto.cpp +++ b/test/mtproto.cpp @@ -367,12 +367,12 @@ class HandshakeTestActor final : public td::Actor { "HandshakeActor", std::move(handshake_), std::move(raw_connection_), td::make_unique(), 10.0, td::PromiseCreator::lambda( - [self = actor_id(this)](td::Result> raw_connection) { - td::send_closure(self, &HandshakeTestActor::got_connection, std::move(raw_connection), 1); + [actor_id = actor_id(this)](td::Result> raw_connection) { + td::send_closure(actor_id, &HandshakeTestActor::got_connection, std::move(raw_connection), 1); }), td::PromiseCreator::lambda( - [self = actor_id(this)](td::Result> handshake) { - td::send_closure(self, &HandshakeTestActor::got_handshake, std::move(handshake), 1); + [actor_id = actor_id(this)](td::Result> handshake) { + td::send_closure(actor_id, &HandshakeTestActor::got_handshake, std::move(handshake), 1); })) .release(); wait_for_raw_connection_ = true; @@ -557,12 +557,12 @@ class FastPingTestActor final : public td::Actor { td::create_actor( "HandshakeActor", std::move(handshake), std::move(raw_connection), td::make_unique(), 10.0, td::PromiseCreator::lambda( - [self = actor_id(this)](td::Result> raw_connection) { - td::send_closure(self, &FastPingTestActor::got_connection, std::move(raw_connection), 1); + [actor_id = actor_id(this)](td::Result> raw_connection) { + td::send_closure(actor_id, &FastPingTestActor::got_connection, std::move(raw_connection), 1); }), td::PromiseCreator::lambda( - [self = actor_id(this)](td::Result> handshake) { - td::send_closure(self, &FastPingTestActor::got_handshake, std::move(handshake), 1); + [actor_id = actor_id(this)](td::Result> handshake) { + td::send_closure(actor_id, &FastPingTestActor::got_handshake, std::move(handshake), 1); })) .release(); } @@ -623,8 +623,8 @@ class FastPingTestActor final : public td::Actor { fast_ping_ = create_ping_actor( td::Slice(), std::move(connection_), std::move(auth_data), td::PromiseCreator::lambda( - [self = actor_id(this)](td::Result> r_raw_connection) { - td::send_closure(self, &FastPingTestActor::got_raw_connection, std::move(r_raw_connection)); + [actor_id = actor_id(this)](td::Result> r_raw_connection) { + td::send_closure(actor_id, &FastPingTestActor::got_raw_connection, std::move(r_raw_connection)); }), td::ActorShared<>()); } diff --git a/test/secret.cpp b/test/secret.cpp index 3bbcf54d9..c2cb0c568 100644 --- a/test/secret.cpp +++ b/test/secret.cpp @@ -791,13 +791,13 @@ class Master final : public Actor { if (can_fail(query) && Random::fast_bool()) { LOG(INFO) << "Fail query " << query; auto resend_promise = - PromiseCreator::lambda([id = actor_shared(this, get_link_token()), callback_actor = callback.get(), + PromiseCreator::lambda([self = actor_shared(this, get_link_token()), callback_actor = callback.get(), callback_token = callback.token()](Result r_net_query) mutable { if (r_net_query.is_error()) { - id.release(); + self.release(); return; } - send_closure(std::move(id), &Master::send_net_query, r_net_query.move_as_ok(), + send_closure(std::move(self), &Master::send_net_query, r_net_query.move_as_ok(), ActorShared(callback_actor, callback_token), true); }); query->set_error(Status::Error(429, "Test error"));