Session: fix warning

GitOrigin-RevId: 6183ab2342222670680057843fc3d908b7995ce8
This commit is contained in:
Arseny Smirnov 2018-05-30 19:38:17 +03:00
parent b315d33462
commit c783a946c3
2 changed files with 15 additions and 2 deletions

View File

@ -39,6 +39,10 @@ class HandshakeActor : public Actor {
void tear_down() override { void tear_down() override {
finish(Status::OK()); finish(Status::OK());
} }
void hangup() override {
finish(Status::Error(1, "Cancelled"));
stop();
}
void timeout_expired() override { void timeout_expired() override {
finish(Status::Error("Timeout expired")); finish(Status::Error("Timeout expired"));
stop(); stop();

View File

@ -78,6 +78,15 @@ class GenAuthKeyActor : public Actor {
})); }));
} }
void hangup() override {
if (connection_promise_) {
connection_promise_.set_error(Status::Error(1, "Cancelled"));
}
if (handshake_promise_) {
handshake_promise_.set_error(Status::Error(1, "Cancelled"));
}
}
void on_connection(Result<std::unique_ptr<mtproto::RawConnection>> r_raw_connection, bool dummy) { void on_connection(Result<std::unique_ptr<mtproto::RawConnection>> r_raw_connection, bool dummy) {
if (r_raw_connection.is_error()) { if (r_raw_connection.is_error()) {
connection_promise_.set_error(r_raw_connection.move_as_error()); connection_promise_.set_error(r_raw_connection.move_as_error());
@ -1082,8 +1091,8 @@ void Session::create_gen_auth_key_actor(HandshakeId handshake_id) {
"GenAuthKey", std::move(info.handshake_), "GenAuthKey", std::move(info.handshake_),
std::make_unique<AuthKeyHandshakeContext>(DhCache::instance(), shared_auth_data_->public_rsa_key()), std::make_unique<AuthKeyHandshakeContext>(DhCache::instance(), shared_auth_data_->public_rsa_key()),
PromiseCreator::lambda([self = actor_id(this)](Result<std::unique_ptr<mtproto::RawConnection>> r_connection) { PromiseCreator::lambda([self = actor_id(this)](Result<std::unique_ptr<mtproto::RawConnection>> r_connection) {
if (r_connection.is_error() && r_connection.error().code() != 1) { if (r_connection.is_error()) {
LOG(WARNING) << r_connection.error(); LOG_IF(WARNING, r_connection.error().code() != 1) << r_connection.error();
return; return;
} }
send_closure(self, &Session::connection_add, r_connection.move_as_ok()); send_closure(self, &Session::connection_add, r_connection.move_as_ok());