[Box Backup-commit] COMMIT r2260 - box/trunk/bin/bbackupquery

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Thu Aug 21 12:14:24 BST 2008


Author: chris
Date: 2008-08-21 12:14:23 +0100 (Thu, 21 Aug 2008)
New Revision: 2260

Modified:
   box/trunk/bin/bbackupquery/BackupQueries.cpp
Log:
Use SelfFlushingStream to ensure that protocol streams are always 
flushed, fixes a problem where local file is not readable during 
compare, and stream was not flushed, breaking the rest of the compare.


Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp
===================================================================
--- box/trunk/bin/bbackupquery/BackupQueries.cpp	2008-08-21 11:12:45 UTC (rev 2259)
+++ box/trunk/bin/bbackupquery/BackupQueries.cpp	2008-08-21 11:14:23 UTC (rev 2260)
@@ -1709,8 +1709,11 @@
 	
 						// Compare contents, if it's a regular file not a link
 						// Remember, we MUST read the entire stream from the server.
+						SelfFlushingStream flushObject(*objectStream);
+
 						if(!fileOnServerStream->IsSymLink())
 						{
+							SelfFlushingStream flushFile(*fileOnServerStream);
 							// Open the local file
 							FileStream l(localPath.c_str());
 							
@@ -1741,28 +1744,6 @@
 							{
 								equal = false;
 							}
-
-							// Must always read the entire decoded stream, if it's not a symlink
-							if(fileOnServerStream->StreamDataLeft())
-							{
-								// Absorb all the data remaining
-								char buffer[2048];
-								while(fileOnServerStream->StreamDataLeft())
-								{
-									fileOnServerStream->Read(buffer, sizeof(buffer), mrConnection.GetTimeout());
-								}
-							}
-
-							// Must always read the entire encoded stream
-							if(objectStream->StreamDataLeft())
-							{
-								// Absorb all the data remaining
-								char buffer[2048];
-								while(objectStream->StreamDataLeft())
-								{
-									objectStream->Read(buffer, sizeof(buffer), mrConnection.GetTimeout());
-								}
-							}
 						}
 					}
 




More information about the Boxbackup-commit mailing list