From 6c4804b5911a50eae2471a2fcd74ed6ab9f727d0 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 1 Feb 2024 12:59:20 +0300 Subject: [PATCH] Add source to SessionProxy::close_session. --- td/telegram/net/SessionProxy.cpp | 11 ++++++----- td/telegram/net/SessionProxy.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/td/telegram/net/SessionProxy.cpp b/td/telegram/net/SessionProxy.cpp index 6a28982b8..db242e696 100644 --- a/td/telegram/net/SessionProxy.cpp +++ b/td/telegram/net/SessionProxy.cpp @@ -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) { diff --git a/td/telegram/net/SessionProxy.h b/td/telegram/net/SessionProxy.h index 0335b9d87..fb3033c52 100644 --- a/td/telegram/net/SessionProxy.h +++ b/td/telegram/net/SessionProxy.h @@ -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();