[Box Backup-dev] COMMIT r453 - box/chris/win32/vc2005-compile-fixes/lib/backupclient

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Sun, 12 Feb 2006 20:36:08 +0000 (GMT)


Author: chris
Date: 2006-02-12 20:36:00 +0000 (Sun, 12 Feb 2006)
New Revision: 453

Modified:
   box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileDiff.cpp
Log:
* BackupStoreFileDiff.cpp
- Move the diff timer expired check to the start of the loop, so it will be
  executed every time round, not bypassed by the break on line 686


Modified: box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileDiff.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileDiff.cpp	2006-02-12 20:33:39 UTC (rev 452)
+++ box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileDiff.cpp	2006-02-12 20:36:00 UTC (rev 453)
@@ -577,6 +577,31 @@
 			int rollOverInitialBytes = 0;
 			while(true)
 			{
+				if(sDiffTimerExpired)
+				{
+					ASSERT(TimeMgmtEpoch > 0);
+					ASSERT(pDiffTimer != NULL);
+					
+					time_t tTotalRunIntvl = time(NULL) - TimeMgmtEpoch;
+					
+					if(MaximumDiffingTime > 0 && 
+						tTotalRunIntvl >= MaximumDiffingTime)
+					{
+						TRACE0("MaximumDiffingTime reached - "
+							"suspending file diff\n");
+						abortSearch = true;
+						break;
+					}
+					else if(KeepAliveTime > 0)
+					{
+						TRACE0("KeepAliveTime reached - "
+							"initiating keep-alive\n");
+						pDiffTimer->DoKeepAlive();
+					}
+
+					sDiffTimerExpired = false;
+				}
+
 				// Load in another block of data, and record how big it is
 				int bytesInEndings = rFile.Read(endings, Sizes[s]);
 				int tmp;
@@ -661,38 +686,12 @@
 							break;
 						}
 
-						bool DiffTimedOut = false;
-						
-						if(sDiffTimerExpired)
-						{
-							ASSERT(TimeMgmtEpoch > 0);
-							ASSERT(pDiffTimer != NULL);
-							
-							time_t tTotalRunIntvl = time(NULL) - TimeMgmtEpoch;
-							
-							if(MaximumDiffingTime > 0 && 
-								tTotalRunIntvl >= MaximumDiffingTime)
-							{
-								TRACE0("MaximumDiffingTime reached - "
-									"suspending file diff\n");
-								DiffTimedOut = true;
-							}
-							else if(KeepAliveTime > 0)
-							{
-								TRACE0("KeepAliveTime reached - "
-									"initiating keep-alive\n");
-								pDiffTimer->DoKeepAlive();
-							}
-
-							sDiffTimerExpired = false;
-						}
-
 						int64_t NumBlocksFound = static_cast<int64_t>(
 							rFoundBlocks.size());
 						int64_t MaxBlocksFound = NumBlocks * 
 							BACKUP_FILE_DIFF_MAX_BLOCK_FIND_MULTIPLE;
 						
-						if(NumBlocksFound > MaxBlocksFound || DiffTimedOut)
+						if(NumBlocksFound > MaxBlocksFound)
 						{
 							abortSearch = true;
 							break;