Unify actor_id/actor_shared names.

This commit is contained in:
levlam 2022-03-05 14:35:19 +03:00
parent 9526d2aa21
commit b2e6da4031
7 changed files with 26 additions and 26 deletions

View File

@ -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;
}
}

View File

@ -812,9 +812,8 @@ 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<SimpleConfigResult> 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<SimpleConfigResult> 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) {

View File

@ -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<string> 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));
});
}

View File

@ -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<secure_storage::Secret> 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));
}));
}

View File

@ -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<AuthKeyHandshakeContext>(DhCache::instance(), shared_auth_data_->public_rsa_key()),
PromiseCreator::lambda(
[self = actor_id(this), guard = callback_](Result<unique_ptr<mtproto::RawConnection>> r_connection) {
[actor_id = actor_id(this), guard = callback_](Result<unique_ptr<mtproto::RawConnection>> 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),

View File

@ -367,12 +367,12 @@ class HandshakeTestActor final : public td::Actor {
"HandshakeActor", std::move(handshake_), std::move(raw_connection_), td::make_unique<HandshakeContext>(),
10.0,
td::PromiseCreator::lambda(
[self = actor_id(this)](td::Result<td::unique_ptr<td::mtproto::RawConnection>> raw_connection) {
td::send_closure(self, &HandshakeTestActor::got_connection, std::move(raw_connection), 1);
[actor_id = actor_id(this)](td::Result<td::unique_ptr<td::mtproto::RawConnection>> raw_connection) {
td::send_closure(actor_id, &HandshakeTestActor::got_connection, std::move(raw_connection), 1);
}),
td::PromiseCreator::lambda(
[self = actor_id(this)](td::Result<td::unique_ptr<td::mtproto::AuthKeyHandshake>> handshake) {
td::send_closure(self, &HandshakeTestActor::got_handshake, std::move(handshake), 1);
[actor_id = actor_id(this)](td::Result<td::unique_ptr<td::mtproto::AuthKeyHandshake>> 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<td::mtproto::HandshakeActor>(
"HandshakeActor", std::move(handshake), std::move(raw_connection), td::make_unique<HandshakeContext>(), 10.0,
td::PromiseCreator::lambda(
[self = actor_id(this)](td::Result<td::unique_ptr<td::mtproto::RawConnection>> raw_connection) {
td::send_closure(self, &FastPingTestActor::got_connection, std::move(raw_connection), 1);
[actor_id = actor_id(this)](td::Result<td::unique_ptr<td::mtproto::RawConnection>> raw_connection) {
td::send_closure(actor_id, &FastPingTestActor::got_connection, std::move(raw_connection), 1);
}),
td::PromiseCreator::lambda(
[self = actor_id(this)](td::Result<td::unique_ptr<td::mtproto::AuthKeyHandshake>> handshake) {
td::send_closure(self, &FastPingTestActor::got_handshake, std::move(handshake), 1);
[actor_id = actor_id(this)](td::Result<td::unique_ptr<td::mtproto::AuthKeyHandshake>> 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<td::unique_ptr<td::mtproto::RawConnection>> r_raw_connection) {
td::send_closure(self, &FastPingTestActor::got_raw_connection, std::move(r_raw_connection));
[actor_id = actor_id(this)](td::Result<td::unique_ptr<td::mtproto::RawConnection>> r_raw_connection) {
td::send_closure(actor_id, &FastPingTestActor::got_raw_connection, std::move(r_raw_connection));
}),
td::ActorShared<>());
}

View File

@ -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<NetQueryPtr> 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<NetQueryCallback>(callback_actor, callback_token), true);
});
query->set_error(Status::Error(429, "Test error"));