From 0fa7b30df320a093cd6ac3b0231652e3322058d2 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Tue, 18 Sep 2012 08:32:17 -0400 Subject: [PATCH] more updates, still not right. --- nucleus/library/filesystem/heavy_file_ops.cpp | 4 +--- .../tentacles/file_transfer_tentacle.cpp | 17 ++++++++++++----- .../library/tentacles/recursive_file_copy.cpp | 16 ++++++---------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/nucleus/library/filesystem/heavy_file_ops.cpp b/nucleus/library/filesystem/heavy_file_ops.cpp index 82d978fc..3ddd7664 100644 --- a/nucleus/library/filesystem/heavy_file_ops.cpp +++ b/nucleus/library/filesystem/heavy_file_ops.cpp @@ -211,12 +211,10 @@ outcome heavy_file_operations::write_file_chunk(const astring &target, basis::outcome heavy_file_operations::advance(const filename_list &to_transfer, file_transfer_header &last_action) { -#ifdef DEBUG_HEAVY_FILE_OPS FUNCDEF("advance"); -#endif int indy = to_transfer.locate(last_action._filename); if (negative(indy)) return BAD_INPUT; // error, file not found in list. - if (indy == to_transfer.elements() - 1) return FINISHED; // done. + if (indy >= to_transfer.elements() - 1) return FINISHED; // done. const file_info *currfile = to_transfer.get(indy + 1); last_action._filename = currfile->raw(); last_action._time = currfile->_time; diff --git a/octopi/library/tentacles/file_transfer_tentacle.cpp b/octopi/library/tentacles/file_transfer_tentacle.cpp index ee0937b2..877672b1 100644 --- a/octopi/library/tentacles/file_transfer_tentacle.cpp +++ b/octopi/library/tentacles/file_transfer_tentacle.cpp @@ -136,7 +136,7 @@ public: // turns a source mapping into the location that it corresponds to. astring translate(const astring &source_path) const { -// FUNCDEF("translate"); + FUNCDEF("translate"); string_array pieces; filename(source_path).separate(pieces); astring source_mapping = pieces[0]; @@ -300,7 +300,7 @@ outcome file_transfer_tentacle::remove_correspondence bool file_transfer_tentacle::get_differences(const octopus_entity &ent, const astring &src, const astring &dest, filename_list &diffs) { -// FUNCDEF("get_differences"); + FUNCDEF("get_differences"); diffs.reset(); AUTO_LOCK; file_transfer_record *the_rec = _transfers->find(ent, src, dest); @@ -315,7 +315,7 @@ bool file_transfer_tentacle::status(const octopus_entity &ent, int &total_files, double ¤t_size, int ¤t_files, bool &done, time_stamp &last_active) { -// FUNCDEF("status"); + FUNCDEF("status"); total_size = 0; total_files = 0; current_files = 0; @@ -714,7 +714,7 @@ outcome file_transfer_tentacle::handle_storage_response outcome file_transfer_tentacle::conclude_storage_request (file_transfer_infoton &req, const octopus_request_id &item_id) { - FUNCDEF("handle_storage_request"); + FUNCDEF("conclude_storage_request"); if (_mode & ONLY_REPORT_DIFFS) { // store an unhandled infoton. unhandled_request *deny = new unhandled_request(item_id, req.classifier(), NO_HANDLER); @@ -741,13 +741,17 @@ outcome file_transfer_tentacle::conclude_storage_request the_rec->_done = true; // we're concluding the transfer, so that's that. resp->_request = false; // it's a response now. store_product(resp, item_id); + + LOG(astring("concluding transfer request on src=") + req._src_root + " dest=" + + req._dest_root); + return common::OKAY; } outcome file_transfer_tentacle::conclude_storage_response (file_transfer_infoton &resp, const octopus_request_id &item_id) { - FUNCDEF("handle_storage_response"); + FUNCDEF("conclude_storage_response"); if (_mode & ONLY_REPORT_DIFFS) { // not spoken here. return NO_HANDLER; @@ -763,6 +767,9 @@ outcome file_transfer_tentacle::conclude_storage_response // mark that we're done now. the_rec->_done = true; + LOG(astring("concluding transfer response on src=") + resp._src_root + " dest=" + + resp._dest_root); + // there is no response product to store. return OKAY; } diff --git a/octopi/library/tentacles/recursive_file_copy.cpp b/octopi/library/tentacles/recursive_file_copy.cpp index 073ddb36..a159c41c 100644 --- a/octopi/library/tentacles/recursive_file_copy.cpp +++ b/octopi/library/tentacles/recursive_file_copy.cpp @@ -165,16 +165,6 @@ outcome recursive_file_copy::copy_hierarchy(int transfer_mode, if (!reply) RETURN_ERROR_RFC("failed to get ongoing transfer reply", NONE_READY); - if (reply->_command == file_transfer_infoton::CONCLUDE_TRANSFER_MARKER) { - BASE_LOG(astring("finished transfer from \"") + source_dir - + "\" to \"" + target_dir + "\""); - break; - } - -// if (!reply->_packed_data.length()) { -// RETURN_ERROR_RFC("file transfer had no packed data", GARBAGE); -// } - byte_array copy = reply->_packed_data; while (copy.length()) { file_time empty; @@ -194,6 +184,12 @@ outcome recursive_file_copy::copy_hierarchy(int transfer_mode, if (copy.length()) RETURN_ERROR_RFC("still had data in array", GARBAGE); + if (reply->_command == file_transfer_infoton::CONCLUDE_TRANSFER_MARKER) { + BASE_LOG(astring("finished transfer from \"") + source_dir + + "\" to \"" + target_dir + "\""); + break; + } + octopus_request_id resp_id(ent, iter + 11); outcome resp_ret = client_spider.evaluate(reply, resp_id); if (resp_ret != tentacle::OKAY) -- 2.34.1