projects
/
feisty_meow.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
got things a bit closer to right, but there is still a nasty problem on
[feisty_meow.git]
/
octopi
/
library
/
tentacles
/
recursive_file_copy.cpp
diff --git
a/octopi/library/tentacles/recursive_file_copy.cpp
b/octopi/library/tentacles/recursive_file_copy.cpp
index e2461ca8a8a9254bbdc8a893d6df8dae80a8b9de..073ddb36851aad94335b2c01c4b4c084c10c8057 100644
(file)
--- a/
octopi/library/tentacles/recursive_file_copy.cpp
+++ b/
octopi/library/tentacles/recursive_file_copy.cpp
@@
-39,7
+39,7
@@
using namespace textual;
namespace octopi {
namespace octopi {
-
//
#define DEBUG_RECURSIVE_FILE_COPY
+#define DEBUG_RECURSIVE_FILE_COPY
// uncomment for noisier debugging.
#define FAKE_HOSTNAME "internal_fake_host"
// uncomment for noisier debugging.
#define FAKE_HOSTNAME "internal_fake_host"
@@
-49,6
+49,11
@@
namespace octopi {
#undef BASE_LOG
#define BASE_LOG(s) EMERGENCY_LOG(program_wide_logger::get(), s)
#undef BASE_LOG
#define BASE_LOG(s) EMERGENCY_LOG(program_wide_logger::get(), s)
+#define RETURN_ERROR_RFC(msg, err) { \
+ LOG(msg); \
+ return err; \
+}
+
const int MAX_CHUNK_RFC_COPY_HIER = 1 * MEGABYTE;
// maximum size for each transfer chunk.
const int MAX_CHUNK_RFC_COPY_HIER = 1 * MEGABYTE;
// maximum size for each transfer chunk.
@@
-62,11
+67,6
@@
recursive_file_copy::~recursive_file_copy() {}
const char *recursive_file_copy::outcome_name(const outcome &to_name)
{ return common::outcome_name(to_name); }
const char *recursive_file_copy::outcome_name(const outcome &to_name)
{ return common::outcome_name(to_name); }
-#define RETURN_ERROR_RFC(msg, err) { \
- LOG(msg); \
- return err; \
-}
-
outcome recursive_file_copy::copy_hierarchy(int transfer_mode,
const astring &source_dir, const astring &target_dir,
const string_array &includes, const astring &source_start)
outcome recursive_file_copy::copy_hierarchy(int transfer_mode,
const astring &source_dir, const astring &target_dir,
const string_array &includes, const astring &source_start)
@@
-171,29
+171,20
@@
outcome recursive_file_copy::copy_hierarchy(int transfer_mode,
break;
}
break;
}
- if (!reply->_packed_data.length()) {
- RETURN_ERROR_RFC("file transfer had no packed data", GARBAGE);
- }
+
//
if (!reply->_packed_data.length()) {
+
//
RETURN_ERROR_RFC("file transfer had no packed data", GARBAGE);
+
//
}
byte_array copy = reply->_packed_data;
while (copy.length()) {
byte_array copy = reply->_packed_data;
while (copy.length()) {
-#ifdef DEBUG_RECURSIVE_FILE_COPY
- LOG(a_sprintf("starging size in array: %d", copy.length()));
-#endif
file_time empty;
file_transfer_header head(empty);
if (!head.unpack(copy))
RETURN_ERROR_RFC("failed to unpack header", GARBAGE);
file_time empty;
file_transfer_header head(empty);
if (!head.unpack(copy))
RETURN_ERROR_RFC("failed to unpack header", GARBAGE);
-#ifdef DEBUG_RECURSIVE_FILE_COPY
- LOG(a_sprintf("removed head size in array: %d", copy.length()));
-#endif
if (copy.length() < head._length)
RETURN_ERROR_RFC("not enough length in array", GARBAGE);
if (copy.length() < head._length)
RETURN_ERROR_RFC("not enough length in array", GARBAGE);
-//hmmm: are we doing nothing here besides validating that we GOT something in the header?
- copy.zap(0, head._length - 1);
-#ifdef DEBUG_RECURSIVE_FILE_COPY
- LOG(a_sprintf("size in array now: %d", copy.length()));
-#endif
+ if (head._length > 0)
+ copy.zap(0, head._length - 1);
//hmmm: this needs better formatting, and should not repeat the same file name even
// if it's in multiple chunks.
//hmmm: this needs better formatting, and should not repeat the same file name even
// if it's in multiple chunks.