Remove unused callback from SessionConnection.

GitOrigin-RevId: d59f2581e57acb8bad96197381d0e0698b932ed2
This commit is contained in:
levlam 2018-12-11 23:34:46 +03:00
parent 6445cf645b
commit 43b61eace0
3 changed files with 9 additions and 12 deletions

View File

@ -186,7 +186,7 @@ class OnPacket {
/*** SessionConnection ***/ /*** SessionConnection ***/
BufferSlice SessionConnection::as_buffer_slice(Slice packet) { 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) { 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(); last_read_at_ = Time::now_cached();
} }
SessionConnection::SessionConnection(Mode mode, unique_ptr<RawConnection> raw_connection, AuthData *auth_data, SessionConnection::SessionConnection(Mode mode, unique_ptr<RawConnection> raw_connection, AuthData *auth_data)
DhCallback *dh_callback) : raw_connection_(std::move(raw_connection)), auth_data_(auth_data) {
: raw_connection_(std::move(raw_connection)), auth_data_(auth_data), dh_callback_(dh_callback) {
state_ = Init; state_ = Init;
mode_ = mode; mode_ = mode;
created_at_ = Time::now(); created_at_ = Time::now();

View File

@ -65,7 +65,7 @@ class SessionConnection
, private RawConnection::Callback { , private RawConnection::Callback {
public: public:
enum class Mode { Tcp, Http, HttpLongPoll }; enum class Mode { Tcp, Http, HttpLongPoll };
SessionConnection(Mode mode, unique_ptr<RawConnection> raw_connection, AuthData *auth_data, DhCallback *dh_callback); SessionConnection(Mode mode, unique_ptr<RawConnection> raw_connection, AuthData *auth_data);
PollableFdInfo &get_poll_info(); PollableFdInfo &get_poll_info();
@ -194,16 +194,15 @@ class SessionConnection
unique_ptr<RawConnection> raw_connection_; unique_ptr<RawConnection> raw_connection_;
AuthData *auth_data_; AuthData *auth_data_;
SessionConnection::Callback *callback_ = nullptr; SessionConnection::Callback *callback_ = nullptr;
DhCallback *dh_callback_; BufferSlice *current_buffer_slice_;
BufferSlice *current_buffer_slice;
friend class OnPacket; friend class OnPacket;
BufferSlice as_buffer_slice(Slice packet); BufferSlice as_buffer_slice(Slice packet);
auto set_buffer_slice(BufferSlice *buffer_slice) TD_WARN_UNUSED_RESULT { auto set_buffer_slice(BufferSlice *buffer_slice) TD_WARN_UNUSED_RESULT {
auto old_buffer_slice = current_buffer_slice; auto old_buffer_slice = current_buffer_slice_;
current_buffer_slice = buffer_slice; current_buffer_slice_ = buffer_slice;
return ScopeExit() + [&to = current_buffer_slice, from = old_buffer_slice] { to = from; }; 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; Status parse_message(TlParser &parser, MsgInfo *info, Slice *packet, bool crypto_flag = true) TD_WARN_UNUSED_RESULT;

View File

@ -963,8 +963,7 @@ void Session::connection_open_finish(ConnectionInfo *info,
auto name = PSTRING() << get_name() << "::Connect::" << mode_name << "::" << raw_connection->debug_str_; auto name = PSTRING() << get_name() << "::Connect::" << mode_name << "::" << raw_connection->debug_str_;
LOG(INFO) << "connection_open_finish: " << name; LOG(INFO) << "connection_open_finish: " << name;
//LOG(ERROR) << "connection_open_finish: " << name; //LOG(ERROR) << "connection_open_finish: " << name;
info->connection = info->connection = make_unique<mtproto::SessionConnection>(mode, std::move(raw_connection), &auth_data_);
make_unique<mtproto::SessionConnection>(mode, std::move(raw_connection), &auth_data_, DhCache::instance());
info->connection->set_online(connection_online_flag_, is_main_); info->connection->set_online(connection_online_flag_, is_main_);
info->connection->set_name(name); info->connection->set_name(name);
Scheduler::subscribe(info->connection->get_poll_info().extract_pollable_fd(this)); Scheduler::subscribe(info->connection->get_poll_info().extract_pollable_fd(this));