From 1ef44d9922592ca8486fbbb866e971c94666c747 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 17 Apr 2014 20:57:33 +0000 Subject: Call RunBackgroundTask while scanning directories as well. Enables bbackupd to be stopped, reloaded or status queried while scanning a large directory. --- bin/bbackupd/BackupClientDirectoryRecord.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/bbackupd/BackupClientDirectoryRecord.cpp b/bin/bbackupd/BackupClientDirectoryRecord.cpp index 43e72be8..c8b95982 100644 --- a/bin/bbackupd/BackupClientDirectoryRecord.cpp +++ b/bin/bbackupd/BackupClientDirectoryRecord.cpp @@ -303,10 +303,19 @@ void BackupClientDirectoryRecord::SyncDirectory( struct dirent *en = 0; EMU_STRUCT_STAT file_st; std::string filename; + int num_entries_found = 0; + while((en = ::readdir(dirHandle)) != 0) { + num_entries_found++; rParams.mrContext.DoKeepAlive(); - + if(rParams.mpBackgroundTask) + { + rParams.mpBackgroundTask->RunBackgroundTask( + BackgroundTask::Scanning_Dirs, + num_entries_found, 0); + } + // Don't need to use // LinuxWorkaround_FinishDirentStruct(en, // rLocalPath.c_str()); -- cgit v1.2.3