[Box Backup-commit] COMMIT r1623 - box/chris/merge/bin/bbackupquery

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Sun, 29 Apr 2007 22:31:14 +0100


Author: chris
Date: 2007-04-29 22:31:14 +0100 (Sun, 29 Apr 2007)
New Revision: 1623

Modified:
   box/chris/merge/bin/bbackupquery/BackupQueries.cpp
Log:
Read any remaining data from the encoded stream (such as EOF marker)
before discarding it, to ensure that we don't break the protocol.
(refs #2, refs #3)


Modified: box/chris/merge/bin/bbackupquery/BackupQueries.cpp
===================================================================
--- box/chris/merge/bin/bbackupquery/BackupQueries.cpp	2007-04-29 13:56:53 UTC (rev 1622)
+++ box/chris/merge/bin/bbackupquery/BackupQueries.cpp	2007-04-29 21:31:14 UTC (rev 1623)
@@ -1695,7 +1695,7 @@
 								equal = false;
 							}
 
-							// Must always read the entire decoded string, if it's not a symlink
+							// Must always read the entire decoded stream, if it's not a symlink
 							if(fileOnServerStream->StreamDataLeft())
 							{
 								// Absorb all the data remaining
@@ -1705,6 +1705,17 @@
 									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());
+								}
+							}
 						}
 					}