From 43b61eace06a601feefa1bbfd52cf52f969ff611 Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 11 Dec 2018 23:34:46 +0300 Subject: [PATCH] Remove unused callback from SessionConnection. GitOrigin-RevId: d59f2581e57acb8bad96197381d0e0698b932ed2 --- td/mtproto/SessionConnection.cpp | 7 +++---- td/mtproto/SessionConnection.h | 11 +++++------ td/telegram/net/Session.cpp | 3 +-- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/td/mtproto/SessionConnection.cpp b/td/mtproto/SessionConnection.cpp index b86167a4..4845eb47 100644 --- a/td/mtproto/SessionConnection.cpp +++ b/td/mtproto/SessionConnection.cpp @@ -186,7 +186,7 @@ class OnPacket { /*** SessionConnection ***/ BufferSlice SessionConnection::as_buffer_slice(Slice packet) { - return current_buffer_slice->from_slice(packet); + return current_buffer_slice_->from_slice(packet); } Status SessionConnection::parse_message(TlParser &parser, MsgInfo *info, Slice *packet, bool crypto_flag) { @@ -694,9 +694,8 @@ void SessionConnection::on_read(size_t size) { last_read_at_ = Time::now_cached(); } -SessionConnection::SessionConnection(Mode mode, unique_ptr raw_connection, AuthData *auth_data, - DhCallback *dh_callback) - : raw_connection_(std::move(raw_connection)), auth_data_(auth_data), dh_callback_(dh_callback) { +SessionConnection::SessionConnection(Mode mode, unique_ptr raw_connection, AuthData *auth_data) + : raw_connection_(std::move(raw_connection)), auth_data_(auth_data) { state_ = Init; mode_ = mode; created_at_ = Time::now(); diff --git a/td/mtproto/SessionConnection.h b/td/mtproto/SessionConnection.h index 7e86e33f..f45ac700 100644 --- a/td/mtproto/SessionConnection.h +++ b/td/mtproto/SessionConnection.h @@ -65,7 +65,7 @@ class SessionConnection , private RawConnection::Callback { public: enum class Mode { Tcp, Http, HttpLongPoll }; - SessionConnection(Mode mode, unique_ptr raw_connection, AuthData *auth_data, DhCallback *dh_callback); + SessionConnection(Mode mode, unique_ptr raw_connection, AuthData *auth_data); PollableFdInfo &get_poll_info(); @@ -194,16 +194,15 @@ class SessionConnection unique_ptr raw_connection_; AuthData *auth_data_; SessionConnection::Callback *callback_ = nullptr; - DhCallback *dh_callback_; - BufferSlice *current_buffer_slice; + BufferSlice *current_buffer_slice_; friend class OnPacket; BufferSlice as_buffer_slice(Slice packet); auto set_buffer_slice(BufferSlice *buffer_slice) TD_WARN_UNUSED_RESULT { - auto old_buffer_slice = current_buffer_slice; - current_buffer_slice = buffer_slice; - return ScopeExit() + [&to = current_buffer_slice, from = old_buffer_slice] { to = from; }; + auto old_buffer_slice = current_buffer_slice_; + current_buffer_slice_ = buffer_slice; + return ScopeExit() + [&to = current_buffer_slice_, from = old_buffer_slice] { to = from; }; } Status parse_message(TlParser &parser, MsgInfo *info, Slice *packet, bool crypto_flag = true) TD_WARN_UNUSED_RESULT; diff --git a/td/telegram/net/Session.cpp b/td/telegram/net/Session.cpp index 0a78c12c..d7842810 100644 --- a/td/telegram/net/Session.cpp +++ b/td/telegram/net/Session.cpp @@ -963,8 +963,7 @@ void Session::connection_open_finish(ConnectionInfo *info, auto name = PSTRING() << get_name() << "::Connect::" << mode_name << "::" << raw_connection->debug_str_; LOG(INFO) << "connection_open_finish: " << name; //LOG(ERROR) << "connection_open_finish: " << name; - info->connection = - make_unique(mode, std::move(raw_connection), &auth_data_, DhCache::instance()); + info->connection = make_unique(mode, std::move(raw_connection), &auth_data_); info->connection->set_online(connection_online_flag_, is_main_); info->connection->set_name(name); Scheduler::subscribe(info->connection->get_poll_info().extract_pollable_fd(this));