mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-03 14:45:12 -04:00
added parameter to disallow hashing files which time is in the future (as they severely perturbate the synchronisation process)
This commit is contained in:
parent
6272856b5e
commit
ba78007cf1
3 changed files with 12 additions and 4 deletions
|
@ -16,8 +16,8 @@
|
|||
namespace librs { namespace util {
|
||||
|
||||
|
||||
FolderIterator::FolderIterator(const std::string& folderName,bool allow_symlinks)
|
||||
: mFolderName(folderName),mAllowSymLinks(allow_symlinks)
|
||||
FolderIterator::FolderIterator(const std::string& folderName, bool allow_symlinks, bool allow_files_from_the_future)
|
||||
: mFolderName(folderName),mAllowSymLinks(allow_symlinks),mAllowFilesFromTheFuture(allow_files_from_the_future)
|
||||
{
|
||||
is_open = false ;
|
||||
validity = false ;
|
||||
|
@ -141,6 +141,13 @@ bool FolderIterator::updateFileInfo(bool& should_skip)
|
|||
{
|
||||
mFileModTime = buf.st_mtime ;
|
||||
|
||||
if(buf.st_mtime > time(NULL) && !mAllowFilesFromTheFuture)
|
||||
{
|
||||
std::cerr << "(II) skipping file with modification time in the future: " << mFullPath << std::endl;
|
||||
should_skip = true ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
if (S_ISDIR(buf.st_mode))
|
||||
{
|
||||
#ifdef DEBUG_FOLDER_ITERATOR
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace librs { namespace util {
|
|||
class FolderIterator
|
||||
{
|
||||
public:
|
||||
FolderIterator(const std::string& folderName,bool allow_symlinks);
|
||||
FolderIterator(const std::string& folderName,bool allow_symlinks,bool allow_files_from_the_future = true);
|
||||
~FolderIterator();
|
||||
|
||||
enum { TYPE_UNKNOWN = 0x00,
|
||||
|
@ -69,6 +69,7 @@ private:
|
|||
std::string mFullPath ;
|
||||
std::string mFolderName ;
|
||||
bool mAllowSymLinks;
|
||||
bool mAllowFilesFromTheFuture;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue