Add source to SessionProxy::close_session.

This commit is contained in:
levlam 2024-02-01 12:59:20 +03:00
parent acec5146ec
commit 6c4804b591
2 changed files with 7 additions and 6 deletions

View File

@ -168,7 +168,7 @@ void SessionProxy::update_main_flag(bool is_main) {
}
LOG(INFO) << "Update is_main to " << is_main;
is_main_ = is_main;
close_session();
close_session("update_main_flag");
open_session();
}
@ -176,19 +176,20 @@ void SessionProxy::on_failed() {
if (session_generation_ != get_link_token()) {
return;
}
close_session();
close_session("on_failed");
open_session();
}
void SessionProxy::update_mtproto_header() {
close_session();
close_session("update_mtproto_header");
open_session();
}
void SessionProxy::on_closed() {
}
void SessionProxy::close_session() {
void SessionProxy::close_session(const char *source) {
LOG(INFO) << "Close session from " << source;
send_closure(std::move(session_), &Session::close);
session_generation_++;
}
@ -244,7 +245,7 @@ void SessionProxy::update_auth_key_state() {
auto old_auth_key_state = auth_key_state_;
auth_key_state_ = get_auth_key_state(auth_data_->get_auth_key());
if (auth_key_state_ != old_auth_key_state && old_auth_key_state == AuthKeyState::OK) {
close_session();
close_session("update_auth_key_state");
}
open_session();
if (session_.empty() || auth_key_state_ != AuthKeyState::OK) {

View File

@ -62,7 +62,7 @@ class SessionProxy final : public Actor {
void on_failed();
void on_closed();
void close_session();
void close_session(const char *source);
void open_session(bool force = false);
void update_auth_key_state();