summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2008-08-21 11:14:23 +0000
committerChris Wilson <chris+github@qwirx.com>2008-08-21 11:14:23 +0000
commitc65bbcc2c29c30e2fa755059e48d07a07f6b4c07 (patch)
tree75b945b6f92adc7c15353a64ee5ab9e7803d2b91 /bin
parent7e4a2bd70befaae8da9bca38a6fbac897760603d (diff)
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.
Diffstat (limited to 'bin')
-rw-r--r--bin/bbackupquery/BackupQueries.cpp25
1 files changed, 3 insertions, 22 deletions
diff --git a/bin/bbackupquery/BackupQueries.cpp b/bin/bbackupquery/BackupQueries.cpp
index 6b0bef82..1a183599 100644
--- a/bin/bbackupquery/BackupQueries.cpp
+++ b/bin/bbackupquery/BackupQueries.cpp
@@ -1709,8 +1709,11 @@ void BackupQueries::Compare(int64_t DirID, const std::string &rStoreDir, const s
// 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 @@ void BackupQueries::Compare(int64_t DirID, const std::string &rStoreDir, const s
{
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());
- }
- }
}
}