From da118270bd5ea0a5b76ae33d331ad16798843d93 Mon Sep 17 00:00:00 2001 From: Arseny Smirnov Date: Fri, 14 Sep 2018 19:58:13 +0300 Subject: [PATCH] Remove TdCallback::on_closed GitOrigin-RevId: e08d6c10e4147c39f2d6f5ea795f92875644f1a7 --- td/telegram/Client.cpp | 2 +- td/telegram/Td.cpp | 1 - td/telegram/TdCallback.h | 6 ------ td/telegram/cli.cpp | 2 +- test/tdclient.cpp | 2 +- 5 files changed, 3 insertions(+), 10 deletions(-) diff --git a/td/telegram/Client.cpp b/td/telegram/Client.cpp index 899b5da4..abac1313 100644 --- a/td/telegram/Client.cpp +++ b/td/telegram/Client.cpp @@ -163,7 +163,7 @@ class Client::Impl final { void on_error(std::uint64_t id, td_api::object_ptr error) override { output_queue_->writer_put({id, std::move(error)}); } - void on_closed() override { + ~Callback() { Scheduler::instance()->finish(); } diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 20e0402e..9d3570a9 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -3713,7 +3713,6 @@ void Td::on_closed() { close_flag_ = 5; send_update( td_api::make_object(td_api::make_object())); - callback_->on_closed(); dec_stop_cnt(); } diff --git a/td/telegram/TdCallback.h b/td/telegram/TdCallback.h index eead22c6..bd840129 100644 --- a/td/telegram/TdCallback.h +++ b/td/telegram/TdCallback.h @@ -33,12 +33,6 @@ class TdCallback { */ virtual void on_error(std::uint64_t id, td_api::object_ptr error) = 0; - /** - * This function is called when TDLib has been fully closed. It's not possible to make any new requests after this function has been called - * without creating a new instance of ClientActor. The callback will be destroyed as soon as a call to this function returns. - */ - virtual void on_closed() = 0; - /** * Destroys the TdCallback. */ diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index acd35016..2020f564 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -673,7 +673,7 @@ class CliClient final : public Actor { void on_error(uint64 id, tl_object_ptr error) override { client_->on_error(id, std::move(error)); } - void on_closed() override { + ~TdCallbackImpl() { client_->on_closed(); } diff --git a/test/tdclient.cpp b/test/tdclient.cpp index fca394ac..6a76eda2 100644 --- a/test/tdclient.cpp +++ b/test/tdclient.cpp @@ -81,7 +81,7 @@ class TestClient : public Actor { void on_error(uint64 id, tl_object_ptr error) override { send_closure(client_, &TestClient::on_error, id, std::move(error)); } - void on_closed() override { + ~TdCallbackImpl() { send_closure(client_, &TestClient::on_closed); }