From 0d1be06cae055a1c9014bb77c7e92e283a066a9c Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 17 Feb 2019 16:52:34 +0300 Subject: [PATCH] Minor fixes. GitOrigin-RevId: 252036493c4c9e94367ef13246bde96b2f89415a --- example/web/tdweb/src/worker.js | 4 ++-- td/telegram/AuthManager.cpp | 1 + td/telegram/NotificationManager.cpp | 1 + td/telegram/PhoneNumberManager.cpp | 2 ++ td/telegram/PhoneNumberManager.h | 3 +-- td/telegram/files/FileManager.cpp | 12 +++++++----- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/example/web/tdweb/src/worker.js b/example/web/tdweb/src/worker.js index 6451e474c..1829d9047 100644 --- a/example/web/tdweb/src/worker.js +++ b/example/web/tdweb/src/worker.js @@ -501,7 +501,7 @@ class TdClient { } if (this.wasFatalError) { if (query['@type'] === 'destroy') { - this.destroy({'@type': 'Ok', '@extra': query['@extra']}); + this.destroy({'@type': 'Ok', '@extra': query['@extra']}); } return; } @@ -631,7 +631,7 @@ class TdClient { log.error('Failed destroy', e); } this.callback(result); - this.callback({ + this.callback({ '@type': 'updateAuthorizationState', authorization_state: { '@type': 'authorizationStateClosed' diff --git a/td/telegram/AuthManager.cpp b/td/telegram/AuthManager.cpp index adea085b2..33d532752 100644 --- a/td/telegram/AuthManager.cpp +++ b/td/telegram/AuthManager.cpp @@ -29,6 +29,7 @@ #include "td/utils/format.h" #include "td/utils/logging.h" #include "td/utils/ScopeGuard.h" +#include "td/utils/Slice.h" #include "td/utils/Time.h" namespace td { diff --git a/td/telegram/NotificationManager.cpp b/td/telegram/NotificationManager.cpp index 9f369a928..f8229de9b 100644 --- a/td/telegram/NotificationManager.cpp +++ b/td/telegram/NotificationManager.cpp @@ -23,6 +23,7 @@ #include "td/utils/as.h" #include "td/utils/base64.h" +#include "td/utils/buffer.h" #include "td/utils/format.h" #include "td/utils/JsonBuilder.h" #include "td/utils/logging.h" diff --git a/td/telegram/PhoneNumberManager.cpp b/td/telegram/PhoneNumberManager.cpp index 1f429de76..fc8e9483f 100644 --- a/td/telegram/PhoneNumberManager.cpp +++ b/td/telegram/PhoneNumberManager.cpp @@ -10,6 +10,8 @@ #include "td/telegram/net/DcId.h" #include "td/telegram/net/NetQueryDispatcher.h" #include "td/telegram/Td.h" +#include "td/telegram/td_api.h" +#include "td/telegram/telegram_api.h" #include "td/utils/logging.h" #include "td/utils/ScopeGuard.h" diff --git a/td/telegram/PhoneNumberManager.h b/td/telegram/PhoneNumberManager.h index cd49445a1..7e74508af 100644 --- a/td/telegram/PhoneNumberManager.h +++ b/td/telegram/PhoneNumberManager.h @@ -9,12 +9,11 @@ #include "td/telegram/net/NetActor.h" #include "td/telegram/net/NetQuery.h" #include "td/telegram/SendCodeHelper.h" -#include "td/telegram/td_api.h" -#include "td/telegram/telegram_api.h" #include "td/actor/actor.h" #include "td/utils/common.h" +#include "td/utils/Status.h" namespace td { diff --git a/td/telegram/files/FileManager.cpp b/td/telegram/files/FileManager.cpp index 56005df3c..e77e0bd03 100644 --- a/td/telegram/files/FileManager.cpp +++ b/td/telegram/files/FileManager.cpp @@ -1967,9 +1967,10 @@ void FileManager::run_download(FileNodePtr node) { class ForceUploadActor : public Actor { public: - ForceUploadActor(FileId file_id, std::shared_ptr callback, int32 new_priority, - uint64 upload_order, ActorShared<> parent) - : file_id_(file_id) + ForceUploadActor(FileManager *file_manager, FileId file_id, std::shared_ptr callback, + int32 new_priority, uint64 upload_order, ActorShared<> parent) + : file_manager_(file_manager) + , file_id_(file_id) , callback_(std::move(callback)) , new_priority_(new_priority) , upload_order_(upload_order) @@ -1977,6 +1978,7 @@ class ForceUploadActor : public Actor { } private: + FileManager *file_manager_; FileId file_id_; std::shared_ptr callback_; int32 new_priority_; @@ -2039,7 +2041,7 @@ class ForceUploadActor : public Actor { } bool is_ready() const { - return G()->file_manager().get_actor_unsafe()->get_file_view(file_id_).has_active_upload_remote_location(); + return !G()->close_flag() && file_manager_->get_file_view(file_id_).has_active_upload_remote_location(); } void on_ok() { @@ -2083,7 +2085,7 @@ class ForceUploadActor : public Actor { void FileManager::resume_upload(FileId file_id, std::vector bad_parts, std::shared_ptr callback, int32 new_priority, uint64 upload_order, bool force) { if (bad_parts.size() == 1 && bad_parts[0] == -1) { - create_actor("ForceUploadActor", file_id, std::move(callback), new_priority, upload_order, + create_actor("ForceUploadActor", this, file_id, std::move(callback), new_priority, upload_order, context_->create_reference()) .release(); return;