Skip to content

Commit

Permalink
Add source to SessionProxy::close_session.
Browse files Browse the repository at this point in the history
  • Loading branch information
levlam committed Feb 1, 2024
1 parent acec514 commit 6c4804b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions td/telegram/net/SessionProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,27 +168,28 @@ 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();
}

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_++;
}
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion td/telegram/net/SessionProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 6c4804b

Please sign in to comment.