diff --git a/libgrive/src/drive/Drive.cc b/libgrive/src/drive/Drive.cc index f83bdd6..f0d454f 100644 --- a/libgrive/src/drive/Drive.cc +++ b/libgrive/src/drive/Drive.cc @@ -140,7 +140,7 @@ void Drive::DetectChanges() Log( "Reading remote server file list", log::info ) ; Feed feed ; - feed.EnableLog( "/tmp/file", ".xml" ) ; +// feed.EnableLog( "/tmp/file", ".xml" ) ; feed.Start( &http, m_http_hdr, feed_base + "?showfolders=true&showroot=true" ) ; m_resume_link = feed.Root()["link"]. @@ -159,7 +159,7 @@ void Drive::DetectChanges() { Log( "Detecting changes from last sync", log::info ) ; Feed changes ; - feed.EnableLog( "/tmp/changes", ".xml" ) ; +// feed.EnableLog( "/tmp/changes", ".xml" ) ; feed.Start( &http, m_http_hdr, ChangesFeed(prev_stamp+1) ) ; std::for_each( diff --git a/libgrive/src/util/Crypt.cc b/libgrive/src/util/Crypt.cc index 6b9ca32..953767d 100644 --- a/libgrive/src/util/Crypt.cc +++ b/libgrive/src/util/Crypt.cc @@ -21,6 +21,7 @@ #include "StdioFile.hh" #include "Exception.hh" +#include "MemMap.hh" #include #include @@ -31,7 +32,8 @@ namespace gr { namespace crypt { -const std::size_t read_size = 8 * 1024 ; +// map 4MB of data at a time +const u64_t read_size = 1024 * 4096 ; struct MD5::Impl { @@ -85,13 +87,14 @@ std::string MD5::Get( const fs::path& file ) std::string MD5::Get( StdioFile& file ) { - char buf[read_size] ; - MD5 crypt ; - std::size_t count = 0 ; - while ( (count = file.Read( buf, sizeof(buf) )) > 0 ) - crypt.Write( buf, count ) ; + u64_t size = file.Size() ; + for ( u64_t i = 0 ; i < size ; i += read_size ) + { + MemMap map( file, i, static_cast(std::min(read_size, size-i)) ) ; + crypt.Write( map.Addr(), map.Length() ) ; + } return crypt.Get() ; }