Remove unused start_part result value.
This commit is contained in:
parent
8755d39bc1
commit
8fee0251f9
@ -18,7 +18,6 @@
|
||||
#include "td/utils/as.h"
|
||||
#include "td/utils/base64.h"
|
||||
#include "td/utils/buffer.h"
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/crypto.h"
|
||||
#include "td/utils/format.h"
|
||||
#include "td/utils/logging.h"
|
||||
@ -223,7 +222,7 @@ Result<bool> FileDownloader::should_restart_part(Part part, const NetQueryPtr &n
|
||||
return false;
|
||||
}
|
||||
|
||||
Result<std::pair<NetQueryPtr, bool>> FileDownloader::start_part(Part part, int32 part_count, int64 streaming_offset) {
|
||||
Result<NetQueryPtr> FileDownloader::start_part(Part part, int32 part_count, int64 streaming_offset) {
|
||||
if (encryption_key_.is_secret()) {
|
||||
part.size = (part.size + 15) & ~15; // fix for last part
|
||||
}
|
||||
@ -282,7 +281,7 @@ Result<std::pair<NetQueryPtr, bool>> FileDownloader::start_part(Part part, int32
|
||||
}
|
||||
}
|
||||
net_query->file_type_ = narrow_cast<int32>(remote_.file_type_);
|
||||
return std::make_pair(std::move(net_query), false);
|
||||
return std::move(net_query);
|
||||
}
|
||||
|
||||
Status FileDownloader::check_net_query(NetQueryPtr &net_query) {
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <utility>
|
||||
|
||||
namespace td {
|
||||
|
||||
class FileDownloader final : public FileLoader {
|
||||
public:
|
||||
class Callback {
|
||||
@ -87,8 +88,7 @@ class FileDownloader final : public FileLoader {
|
||||
Status on_ok(int64 size) final TD_WARN_UNUSED_RESULT;
|
||||
void on_error(Status status) final;
|
||||
Result<bool> should_restart_part(Part part, const NetQueryPtr &net_query) final TD_WARN_UNUSED_RESULT;
|
||||
Result<std::pair<NetQueryPtr, bool>> start_part(Part part, int32 part_count,
|
||||
int64 streaming_offset) final TD_WARN_UNUSED_RESULT;
|
||||
Result<NetQueryPtr> start_part(Part part, int32 part_count, int64 streaming_offset) final TD_WARN_UNUSED_RESULT;
|
||||
Result<size_t> process_part(Part part, NetQueryPtr net_query) final TD_WARN_UNUSED_RESULT;
|
||||
void on_progress(Progress progress) final;
|
||||
Status process_check_query(NetQueryPtr net_query) final;
|
||||
@ -102,4 +102,5 @@ class FileDownloader final : public FileLoader {
|
||||
|
||||
Status check_net_query(NetQueryPtr &net_query);
|
||||
};
|
||||
|
||||
} // namespace td
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "td/telegram/files/FileLoader.h"
|
||||
|
||||
#include "td/telegram/files/FileLoaderUtils.h"
|
||||
#include "td/telegram/files/ResourceManager.h"
|
||||
#include "td/telegram/Global.h"
|
||||
#include "td/telegram/net/NetQueryDispatcher.h"
|
||||
#include "td/telegram/UniqueId.h"
|
||||
@ -18,8 +17,6 @@
|
||||
#include "td/utils/misc.h"
|
||||
#include "td/utils/ScopeGuard.h"
|
||||
|
||||
#include <tuple>
|
||||
|
||||
namespace td {
|
||||
|
||||
void FileLoader::set_resource_manager(ActorShared<ResourceManager> resource_manager) {
|
||||
@ -192,9 +189,6 @@ Status FileLoader::do_loop() {
|
||||
after_start_parts();
|
||||
};
|
||||
while (true) {
|
||||
if (blocking_id_ != 0) {
|
||||
break;
|
||||
}
|
||||
if (resource_state_.unused() < narrow_cast<int64>(parts_manager_.get_part_size())) {
|
||||
VLOG(file_loader) << "Receive only " << resource_state_.unused() << " resource";
|
||||
break;
|
||||
@ -206,15 +200,8 @@ Status FileLoader::do_loop() {
|
||||
VLOG(file_loader) << "Start part " << tag("id", part.id) << tag("size", part.size);
|
||||
resource_state_.start_use(static_cast<int64>(part.size));
|
||||
|
||||
TRY_RESULT(query_flag, start_part(part, parts_manager_.get_part_count(), parts_manager_.get_streaming_offset()));
|
||||
NetQueryPtr query;
|
||||
bool is_blocking;
|
||||
std::tie(query, is_blocking) = std::move(query_flag);
|
||||
TRY_RESULT(query, start_part(part, parts_manager_.get_part_count(), parts_manager_.get_streaming_offset()));
|
||||
uint64 unique_id = UniqueId::next();
|
||||
if (is_blocking) {
|
||||
CHECK(blocking_id_ == 0);
|
||||
blocking_id_ = unique_id;
|
||||
}
|
||||
part_map_[unique_id] = std::make_pair(part, query->cancel_slot_.get_signal_new());
|
||||
// part_map_[unique_id] = std::make_pair(part, query.get_weak());
|
||||
|
||||
@ -259,9 +246,6 @@ void FileLoader::on_result(NetQueryPtr query) {
|
||||
return;
|
||||
}
|
||||
auto unique_id = get_link_token();
|
||||
if (unique_id == blocking_id_) {
|
||||
blocking_id_ = 0;
|
||||
}
|
||||
if (UniqueId::extract_key(unique_id) == COMMON_QUERY_KEY) {
|
||||
on_common_query(std::move(query));
|
||||
return loop();
|
||||
|
@ -61,8 +61,7 @@ class FileLoader : public FileLoaderActor {
|
||||
virtual Status before_start_parts() {
|
||||
return Status::OK();
|
||||
}
|
||||
virtual Result<std::pair<NetQueryPtr, bool>> start_part(Part part, int part_count,
|
||||
int64 streaming_offset) TD_WARN_UNUSED_RESULT = 0;
|
||||
virtual Result<NetQueryPtr> start_part(Part part, int part_count, int64 streaming_offset) TD_WARN_UNUSED_RESULT = 0;
|
||||
virtual void after_start_parts() {
|
||||
}
|
||||
virtual Result<size_t> process_part(Part part, NetQueryPtr net_query) TD_WARN_UNUSED_RESULT = 0;
|
||||
@ -106,7 +105,6 @@ class FileLoader : public FileLoaderActor {
|
||||
ActorShared<ResourceManager> resource_manager_;
|
||||
ResourceState resource_state_;
|
||||
PartsManager parts_manager_;
|
||||
uint64 blocking_id_{0};
|
||||
std::map<uint64, std::pair<Part, ActorShared<>>> part_map_;
|
||||
bool ordered_flag_ = false;
|
||||
OrderedEventsProcessor<std::pair<Part, NetQueryPtr>> ordered_parts_;
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "td/telegram/telegram_api.h"
|
||||
|
||||
#include "td/utils/buffer.h"
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/crypto.h"
|
||||
#include "td/utils/format.h"
|
||||
#include "td/utils/logging.h"
|
||||
@ -249,7 +248,7 @@ void FileUploader::after_start_parts() {
|
||||
try_release_fd();
|
||||
}
|
||||
|
||||
Result<std::pair<NetQueryPtr, bool>> FileUploader::start_part(Part part, int32 part_count, int64 streaming_offset) {
|
||||
Result<NetQueryPtr> FileUploader::start_part(Part part, int32 part_count, int64 streaming_offset) {
|
||||
auto padded_size = part.size;
|
||||
if (encryption_key_.is_secret()) {
|
||||
padded_size = (padded_size + 15) & ~15;
|
||||
@ -287,7 +286,7 @@ Result<std::pair<NetQueryPtr, bool>> FileUploader::start_part(Part part, int32 p
|
||||
net_query = G()->net_query_creator().create(query, {}, DcId::main(), NetQuery::Type::Upload);
|
||||
}
|
||||
net_query->file_type_ = narrow_cast<int32>(file_type_);
|
||||
return std::make_pair(std::move(net_query), false);
|
||||
return std::move(net_query);
|
||||
}
|
||||
|
||||
Result<size_t> FileUploader::process_part(Part part, NetQueryPtr net_query) {
|
||||
|
@ -67,8 +67,7 @@ class FileUploader final : public FileLoader {
|
||||
void on_error(Status status) final;
|
||||
Status before_start_parts() final;
|
||||
void after_start_parts() final;
|
||||
Result<std::pair<NetQueryPtr, bool>> start_part(Part part, int32 part_count,
|
||||
int64 streaming_offset) final TD_WARN_UNUSED_RESULT;
|
||||
Result<NetQueryPtr> start_part(Part part, int32 part_count, int64 streaming_offset) final TD_WARN_UNUSED_RESULT;
|
||||
Result<size_t> process_part(Part part, NetQueryPtr net_query) final TD_WARN_UNUSED_RESULT;
|
||||
void on_progress(Progress progress) final;
|
||||
Result<PrefixInfo> on_update_local_location(const LocalFileLocation &location,
|
||||
|
Loading…
x
Reference in New Issue
Block a user