projects
/
feisty_meow.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
2c9b4cc
)
cleaning up implementation a bit more.
author
Chris Koeritz
<fred@gruntose.com>
Tue, 18 Sep 2012 04:17:26 +0000
(
00:17
-0400)
committer
Chris Koeritz
<fred@gruntose.com>
Tue, 18 Sep 2012 04:17:26 +0000
(
00:17
-0400)
nucleus/library/filesystem/heavy_file_ops.cpp
patch
|
blob
|
history
nucleus/library/filesystem/heavy_file_ops.h
patch
|
blob
|
history
octopi/library/tentacles/file_transfer_tentacle.cpp
patch
|
blob
|
history
diff --git
a/nucleus/library/filesystem/heavy_file_ops.cpp
b/nucleus/library/filesystem/heavy_file_ops.cpp
index 6f5b19db1832feffb4e815c3df9c05069745a541..82d978fc1e0f0921e0df085f54020bbe127be72b 100644
(file)
--- a/
nucleus/library/filesystem/heavy_file_ops.cpp
+++ b/
nucleus/library/filesystem/heavy_file_ops.cpp
@@
-208,15
+208,15
@@
outcome heavy_file_operations::write_file_chunk(const astring &target,
return OKAY;
}
return OKAY;
}
-b
ool
heavy_file_operations::advance(const filename_list &to_transfer,
+b
asis::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);
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
false; // error
.
- if (indy == to_transfer.elements() - 1) return
false
; // done.
+ if (negative(indy)) return
BAD_INPUT; // error, file not found in list
.
+ 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;
const file_info *currfile = to_transfer.get(indy + 1);
last_action._filename = currfile->raw();
last_action._time = currfile->_time;
@@
-228,7
+228,7
@@
bool heavy_file_operations::advance(const filename_list &to_transfer,
last_action._byte_start = 0;
last_action._length = 0;
last_action._byte_start = 0;
last_action._length = 0;
- return
true
;
+ return
OKAY
;
}
outcome heavy_file_operations::buffer_files(const astring &source_root,
}
outcome heavy_file_operations::buffer_files(const astring &source_root,
@@
-276,14
+276,16
@@
outcome heavy_file_operations::buffer_files(const astring &source_root,
if (!current.good()) {
// we need to skip this file.
LOG(astring("skipping bad file: ") + full_file);
if (!current.good()) {
// we need to skip this file.
LOG(astring("skipping bad file: ") + full_file);
- if (!advance(to_transfer, last_action)) break;
+ to_return = advance(to_transfer, last_action);
+ if (to_return != OKAY) break;
continue;
}
if (last_action._byte_start + last_action._length >= current.length()) {
continue;
}
if (last_action._byte_start + last_action._length >= current.length()) {
-LOG(astring("finished
handl
ing file: ") + full_file);
+LOG(astring("finished
stuff
ing file: ") + full_file);
// this file is done now. go to the next one.
// this file is done now. go to the next one.
- if (!advance(to_transfer, last_action)) break;
+ to_return = advance(to_transfer, last_action);
+ if (to_return != OKAY) break;
continue;
}
continue;
}
@@
-302,7
+304,8
@@
LOG(astring("finished handling file: ") + full_file);
if (bytes_read != new_len) {
if (!bytes_read) {
// some kind of problem reading the file.
if (bytes_read != new_len) {
if (!bytes_read) {
// some kind of problem reading the file.
- if (!advance(to_transfer, last_action)) break;
+ to_return = advance(to_transfer, last_action);
+ if (to_return != OKAY) break;
continue;
}
//why would this happen? just complain, i guess.
continue;
}
//why would this happen? just complain, i guess.
@@
-319,7
+322,8
@@
LOG(astring("finished handling file: ") + full_file);
if (!current.length()) {
// ensure we don't get stuck redoing zero length files, which we allowed
// to go past their end above (since otherwise we'd never see them).
if (!current.length()) {
// ensure we don't get stuck redoing zero length files, which we allowed
// to go past their end above (since otherwise we'd never see them).
- if (!advance(to_transfer, last_action)) break;
+ to_return = advance(to_transfer, last_action);
+ if (to_return != OKAY) break;
continue;
}
continue;
}
diff --git
a/nucleus/library/filesystem/heavy_file_ops.h
b/nucleus/library/filesystem/heavy_file_ops.h
index 8cfdc42f258cc627d866094dcb7b232020d122f5..028bb8e2be41f0542bd28a891e2848d7a979cf5b 100644
(file)
--- a/
nucleus/library/filesystem/heavy_file_ops.h
+++ b/
nucleus/library/filesystem/heavy_file_ops.h
@@
-107,7
+107,8
@@
public:
out before bytes are stored into it; this is not an additive operation. */
private:
out before bytes are stored into it; this is not an additive operation. */
private:
- static bool advance(const filename_list &to_transfer, file_transfer_header &last_action);
+ static basis::outcome advance(const filename_list &to_transfer,
+ file_transfer_header &last_action);
//!< advances to the next file in the transfer list "to_transfer".
};
//!< advances to the next file in the transfer list "to_transfer".
};
diff --git
a/octopi/library/tentacles/file_transfer_tentacle.cpp
b/octopi/library/tentacles/file_transfer_tentacle.cpp
index 717d276120d5c3c396fd3c0e00917b2e398e8f92..ee0937b287c154f4b01169a28e487fff3ef2a347 100644
(file)
--- a/
octopi/library/tentacles/file_transfer_tentacle.cpp
+++ b/
octopi/library/tentacles/file_transfer_tentacle.cpp
@@
-620,8
+620,7
@@
outcome file_transfer_tentacle::handle_storage_request
(_correspondences->translate(the_rec->_src_root), *the_rec->_diffs,
the_rec->_last_sent, resp->_packed_data, _maximum_transfer);
if (bufret == heavy_file_operations::FINISHED) {
(_correspondences->translate(the_rec->_src_root), *the_rec->_diffs,
the_rec->_last_sent, resp->_packed_data, _maximum_transfer);
if (bufret == heavy_file_operations::FINISHED) {
-//here we go. finish by setting command to conclude.
-LOG("got the final marker saying heavy file ops done!");
+ // finish by setting command to be a conclude marker.
the_rec->_done = true;
resp->_command = file_transfer_infoton::CONCLUDE_TRANSFER_MARKER;
bufret = OKAY; // now it's no longer an exceptional outcome.
the_rec->_done = true;
resp->_command = file_transfer_infoton::CONCLUDE_TRANSFER_MARKER;
bufret = OKAY; // now it's no longer an exceptional outcome.
@@
-632,16
+631,13
@@
LOG("got the final marker saying heavy file ops done!");
+ req._dest_root);
}
+ req._dest_root);
}
-// if ( (bufret == OKAY) && !resp->_packed_data.length() ) {
-// LOG(astring("failed to pack any data for file: ") + req._src_root);
-// }
-
- if (!the_rec->_done && (bufret == OKAY) && !resp->_packed_data.length() ) {
- // seems like the transfer is done.
+//can remove this block if stops saying it.
+ if ((bufret == OKAY) && !resp->_packed_data.length() ) {
LOG("marking empty transfer as done; why not caught above at FINISHED check?");
the_rec->_done = true;
resp->_command = file_transfer_infoton::CONCLUDE_TRANSFER_MARKER;
}
LOG("marking empty transfer as done; why not caught above at FINISHED check?");
the_rec->_done = true;
resp->_command = file_transfer_infoton::CONCLUDE_TRANSFER_MARKER;
}
+//end of can remove.
resp->_request = false; // it's a response now.
store_product(resp, item_id);
resp->_request = false; // it's a response now.
store_product(resp, item_id);