mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -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
@ -141,7 +141,7 @@ void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_p
|
||||
// make sure list of subfiles is the same
|
||||
// request all hashes to the hashcache
|
||||
|
||||
librs::util::FolderIterator dirIt(cumulated_path,false);
|
||||
librs::util::FolderIterator dirIt(cumulated_path,false,false); // disallow symbolic links and files from the future.
|
||||
|
||||
time_t dir_local_mod_time ;
|
||||
if(!mSharedDirectories->getDirectoryLocalModTime(indx,dir_local_mod_time))
|
||||
|
@ -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…
Reference in New Issue
Block a user