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:
f23a76d
)
perhaps stupid zero-length file bug is fixed.
author
Chris Koeritz
<fred@gruntose.com>
Tue, 12 Feb 2013 17:10:41 +0000
(12:10 -0500)
committer
Chris Koeritz
<fred@gruntose.com>
Tue, 12 Feb 2013 17:10:41 +0000
(12:10 -0500)
nucleus/library/filesystem/byte_filer.cpp
patch
|
blob
|
history
nucleus/library/filesystem/byte_filer.h
patch
|
blob
|
history
nucleus/library/filesystem/heavy_file_ops.cpp
patch
|
blob
|
history
nucleus/library/filesystem/huge_file.cpp
patch
|
blob
|
history
nucleus/library/filesystem/huge_file.h
patch
|
blob
|
history
octopi/library/tentacles/file_transfer_tentacle.cpp
patch
|
blob
|
history
diff --git
a/nucleus/library/filesystem/byte_filer.cpp
b/nucleus/library/filesystem/byte_filer.cpp
index 005b2955c92dee5c86dacca37a8492092a6a2081..bc6779c4f0b0be0ef4da9fba650b3787fb62be7a 100644
(file)
--- a/
nucleus/library/filesystem/byte_filer.cpp
+++ b/
nucleus/library/filesystem/byte_filer.cpp
@@
-79,7
+79,7
@@
byte_filer::byte_filer(bool auto_close, void *handle)
byte_filer::~byte_filer() { close(); WHACK(_handle); WHACK(_filename); }
byte_filer::~byte_filer() { close(); WHACK(_handle); WHACK(_filename); }
-
astring
byte_filer::name() const { return _filename->raw(); }
+
const astring &
byte_filer::name() const { return _filename->raw(); }
size_t byte_filer::file_size_limit() { return BTFL_FILE_TELL_LIMIT; }
size_t byte_filer::file_size_limit() { return BTFL_FILE_TELL_LIMIT; }
diff --git
a/nucleus/library/filesystem/byte_filer.h
b/nucleus/library/filesystem/byte_filer.h
index 34e6379c80a7db79558b53cae5e9a10697ba647a..5675a3e5e725ab5739d71cf9ae44895172712689 100644
(file)
--- a/
nucleus/library/filesystem/byte_filer.h
+++ b/
nucleus/library/filesystem/byte_filer.h
@@
-72,7
+72,7
@@
public:
//!< shuts down the open file, if any.
/*!< open() will have to be invoked before this object can be used again. */
//!< shuts down the open file, if any.
/*!< open() will have to be invoked before this object can be used again. */
-
basis::astring
name() const;
+
const basis::astring &
name() const;
//!< returns the file name that the object is operating on.
bool good();
//!< returns the file name that the object is operating on.
bool good();
diff --git
a/nucleus/library/filesystem/heavy_file_ops.cpp
b/nucleus/library/filesystem/heavy_file_ops.cpp
index 695746c8c7ad254b16799a9152a300c6a5c73361..5922d0c0c14ae68c8776da1c5e00e124b4cfe92d 100644
(file)
--- a/
nucleus/library/filesystem/heavy_file_ops.cpp
+++ b/
nucleus/library/filesystem/heavy_file_ops.cpp
@@
-249,6
+249,9
@@
outcome heavy_file_operations::buffer_files(const astring &source_root,
outcome to_return = OKAY;
outcome to_return = OKAY;
+ // this records if we're working on a new file.
+ bool fresh_file = false;
+
// start filling the array with bytes from the files.
while (storage.length() < maximum_bytes) {
double remaining_in_array = maximum_bytes - storage.length()
// start filling the array with bytes from the files.
while (storage.length() < maximum_bytes) {
double remaining_in_array = maximum_bytes - storage.length()
@@
-267,11
+270,13
@@
outcome heavy_file_operations::buffer_files(const astring &source_root,
last_action._time = currfile->_time;
last_action._byte_start = 0;
last_action._length = 0;
last_action._time = currfile->_time;
last_action._byte_start = 0;
last_action._length = 0;
+ fresh_file = true;
}
const file_info *found = to_transfer.find(last_action._filename);
if (!found) {
// they have referenced a file that we don't have. that's bad news.
}
const file_info *found = to_transfer.find(last_action._filename);
if (!found) {
// they have referenced a file that we don't have. that's bad news.
+ LOG(astring("unknown last file requested in transfer: ") + last_action._filename);
return BAD_INPUT;
}
return BAD_INPUT;
}
@@
-280,20
+285,27
@@
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);
+ fresh_file = true;
to_return = advance(to_transfer, last_action);
if (to_return != OKAY) break;
continue;
}
to_return = advance(to_transfer, last_action);
if (to_return != OKAY) break;
continue;
}
+LOG(astring("working on file: ") + current.name());
- if (last_action._byte_start + last_action._length >= current.length()) {
+ // we don't try to check done if we just started this file.
+ if (!fresh_file && (last_action._byte_start + last_action._length >= current.length())) {
// this file is done now. go to the next one.
#ifdef DEBUG_HEAVY_FILE_OPS
LOG(astring("finished stuffing file: ") + full_file);
#endif
// this file is done now. go to the next one.
#ifdef DEBUG_HEAVY_FILE_OPS
LOG(astring("finished stuffing file: ") + full_file);
#endif
+ fresh_file = true;
to_return = advance(to_transfer, last_action);
if (to_return != OKAY) break;
continue;
}
to_return = advance(to_transfer, last_action);
if (to_return != OKAY) break;
continue;
}
+ // now that we tested if the file was fresh in our 'finished' check above, we
+ // consider the file not to be fresh until told otherwise.
+ fresh_file = false;
// calculate the largest piece remaining of that file that will fit in the
// allotted space.
// calculate the largest piece remaining of that file that will fit in the
// allotted space.
@@
-310,6
+322,7
@@
outcome heavy_file_operations::buffer_files(const astring &source_root,
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.
+ fresh_file = true;
to_return = advance(to_transfer, last_action);
if (to_return != OKAY) break;
continue;
to_return = advance(to_transfer, last_action);
if (to_return != OKAY) break;
continue;
@@
-328,6
+341,7
@@
outcome heavy_file_operations::buffer_files(const astring &source_root,
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).
+ fresh_file = true;
to_return = advance(to_transfer, last_action);
if (to_return != OKAY) break;
continue;
to_return = advance(to_transfer, last_action);
if (to_return != OKAY) break;
continue;
diff --git
a/nucleus/library/filesystem/huge_file.cpp
b/nucleus/library/filesystem/huge_file.cpp
index bdc1522835e1a3956a6c5476ceb91d858b44f824..f452fd30e32bb93b923ee0749bfae72a116469b0 100644
(file)
--- a/
nucleus/library/filesystem/huge_file.cpp
+++ b/
nucleus/library/filesystem/huge_file.cpp
@@
-43,6
+43,8
@@
huge_file::~huge_file()
WHACK(_real_file);
}
WHACK(_real_file);
}
+const astring &huge_file::name() const { return _real_file->name(); }
+
void huge_file::flush() { _real_file->flush(); }
bool huge_file::truncate() { return _real_file->truncate(); }
void huge_file::flush() { _real_file->flush(); }
bool huge_file::truncate() { return _real_file->truncate(); }
diff --git
a/nucleus/library/filesystem/huge_file.h
b/nucleus/library/filesystem/huge_file.h
index 28fd1d6161a98f734902ff08fe34bee9ea59402b..2534f97ac23a2c480e0724c286967fa4b7527d77 100644
(file)
--- a/
nucleus/library/filesystem/huge_file.h
+++ b/
nucleus/library/filesystem/huge_file.h
@@
-50,6
+50,9
@@
public:
BAD_INPUT = basis::common::BAD_INPUT
};
BAD_INPUT = basis::common::BAD_INPUT
};
+ const basis::astring &name() const;
+ //!< returns the name of the file this operates on.
+
bool good() const;
//!< reports if the file was opened successfully.
bool good() const;
//!< reports if the file was opened successfully.
diff --git
a/octopi/library/tentacles/file_transfer_tentacle.cpp
b/octopi/library/tentacles/file_transfer_tentacle.cpp
index 60bb2d6fc7a3533f84bae5f64a0471445d9007da..0626fb1297d047db9e085587f3310a480435f218 100644
(file)
--- a/
octopi/library/tentacles/file_transfer_tentacle.cpp
+++ b/
octopi/library/tentacles/file_transfer_tentacle.cpp
@@
-794,7
+794,7
@@
outcome file_transfer_tentacle::handle_storage_response
astring full_file = resp._dest_root + filename::default_separator()
+ recorded_info->secondary();
astring full_file = resp._dest_root + filename::default_separator()
+ recorded_info->secondary();
-//LOG(astring("telling it to write to fullfile: ") + full_file);
+//
LOG(astring("telling it to write to fullfile: ") + full_file);
outcome ret = heavy_file_operations::write_file_chunk(full_file,
found._byte_start, to_write);
outcome ret = heavy_file_operations::write_file_chunk(full_file,
found._byte_start, to_write);