Minor fixes.

GitOrigin-RevId: 252036493c4c9e94367ef13246bde96b2f89415a
This commit is contained in:
levlam 2019-02-17 16:52:34 +03:00
parent 5d1f93c1c5
commit 0d1be06cae
6 changed files with 14 additions and 9 deletions

View File

@ -29,6 +29,7 @@
#include "td/utils/format.h" #include "td/utils/format.h"
#include "td/utils/logging.h" #include "td/utils/logging.h"
#include "td/utils/ScopeGuard.h" #include "td/utils/ScopeGuard.h"
#include "td/utils/Slice.h"
#include "td/utils/Time.h" #include "td/utils/Time.h"
namespace td { namespace td {

View File

@ -23,6 +23,7 @@
#include "td/utils/as.h" #include "td/utils/as.h"
#include "td/utils/base64.h" #include "td/utils/base64.h"
#include "td/utils/buffer.h"
#include "td/utils/format.h" #include "td/utils/format.h"
#include "td/utils/JsonBuilder.h" #include "td/utils/JsonBuilder.h"
#include "td/utils/logging.h" #include "td/utils/logging.h"

View File

@ -10,6 +10,8 @@
#include "td/telegram/net/DcId.h" #include "td/telegram/net/DcId.h"
#include "td/telegram/net/NetQueryDispatcher.h" #include "td/telegram/net/NetQueryDispatcher.h"
#include "td/telegram/Td.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/logging.h"
#include "td/utils/ScopeGuard.h" #include "td/utils/ScopeGuard.h"

View File

@ -9,12 +9,11 @@
#include "td/telegram/net/NetActor.h" #include "td/telegram/net/NetActor.h"
#include "td/telegram/net/NetQuery.h" #include "td/telegram/net/NetQuery.h"
#include "td/telegram/SendCodeHelper.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/actor/actor.h"
#include "td/utils/common.h" #include "td/utils/common.h"
#include "td/utils/Status.h"
namespace td { namespace td {

View File

@ -1967,9 +1967,10 @@ void FileManager::run_download(FileNodePtr node) {
class ForceUploadActor : public Actor { class ForceUploadActor : public Actor {
public: public:
ForceUploadActor(FileId file_id, std::shared_ptr<FileManager::UploadCallback> callback, int32 new_priority, ForceUploadActor(FileManager *file_manager, FileId file_id, std::shared_ptr<FileManager::UploadCallback> callback,
uint64 upload_order, ActorShared<> parent) int32 new_priority, uint64 upload_order, ActorShared<> parent)
: file_id_(file_id) : file_manager_(file_manager)
, file_id_(file_id)
, callback_(std::move(callback)) , callback_(std::move(callback))
, new_priority_(new_priority) , new_priority_(new_priority)
, upload_order_(upload_order) , upload_order_(upload_order)
@ -1977,6 +1978,7 @@ class ForceUploadActor : public Actor {
} }
private: private:
FileManager *file_manager_;
FileId file_id_; FileId file_id_;
std::shared_ptr<FileManager::UploadCallback> callback_; std::shared_ptr<FileManager::UploadCallback> callback_;
int32 new_priority_; int32 new_priority_;
@ -2039,7 +2041,7 @@ class ForceUploadActor : public Actor {
} }
bool is_ready() const { 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() { void on_ok() {
@ -2083,7 +2085,7 @@ class ForceUploadActor : public Actor {
void FileManager::resume_upload(FileId file_id, std::vector<int> bad_parts, std::shared_ptr<UploadCallback> callback, void FileManager::resume_upload(FileId file_id, std::vector<int> bad_parts, std::shared_ptr<UploadCallback> callback,
int32 new_priority, uint64 upload_order, bool force) { int32 new_priority, uint64 upload_order, bool force) {
if (bad_parts.size() == 1 && bad_parts[0] == -1) { if (bad_parts.size() == 1 && bad_parts[0] == -1) {
create_actor<ForceUploadActor>("ForceUploadActor", file_id, std::move(callback), new_priority, upload_order, create_actor<ForceUploadActor>("ForceUploadActor", this, file_id, std::move(callback), new_priority, upload_order,
context_->create_reference()) context_->create_reference())
.release(); .release();
return; return;