Attempt to fix binlog_pmc_ bug in ConfigSession::HandshakeActor

GitOrigin-RevId: 6486e37b16a39c4088faa5a2aedc674e6feb2e89
This commit is contained in:
Arseny Smirnov 2019-06-19 15:56:55 +02:00
parent f4bea9a891
commit a569a1eac7

View File

@ -1120,21 +1120,22 @@ void Session::create_gen_auth_key_actor(HandshakeId handshake_id) {
info.actor_ = create_actor<detail::GenAuthKeyActor>(
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)](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());
}),
PromiseCreator::lambda(
[self = actor_shared(this, handshake_id + 1), handshake_perf = PerfWarningTimer("handshake", 1000.1)](
Result<unique_ptr<mtproto::AuthKeyHandshake>> handshake) mutable {
// later is just to avoid lost hangup
send_closure_later(std::move(self), &Session::on_handshake_ready, std::move(handshake));
[self = 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());
}),
PromiseCreator::lambda([self = actor_shared(this, handshake_id + 1),
handshake_perf = PerfWarningTimer("handshake", 1000.1),
guard = callback_](Result<unique_ptr<mtproto::AuthKeyHandshake>> handshake) mutable {
// later is just to avoid lost hangup
send_closure_later(std::move(self), &Session::on_handshake_ready, std::move(handshake));
}),
callback_);
}