summaryrefslogtreecommitdiff
path: root/lib/backupclient
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2007-04-28 19:57:24 +0000
committerChris Wilson <chris+github@qwirx.com>2007-04-28 19:57:24 +0000
commit4f98aedc41c41afa7ed0388ec838b96829d0577f (patch)
treee95cac96db99e6c71a3961b8b9d7f8126a8fc939 /lib/backupclient
parent82bea7ee6395af37ff2b6183e4ed49313dcc3539 (diff)
Fix getting files with uncertain size (over 2GB) from the store. Failure
to drain the stream will leave the EOF byte in it, which breaks further communications with the store over the same connection. (refs #2, refs #3)
Diffstat (limited to 'lib/backupclient')
-rw-r--r--lib/backupclient/BackupStoreFile.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/backupclient/BackupStoreFile.cpp b/lib/backupclient/BackupStoreFile.cpp
index 5c621f38..5e800970 100644
--- a/lib/backupclient/BackupStoreFile.cpp
+++ b/lib/backupclient/BackupStoreFile.cpp
@@ -292,6 +292,14 @@ void BackupStoreFile::DecodeFile(IOStream &rEncodedFile, const char *DecodedFile
}
out.Close();
+
+ // The stream might have uncertain size, in which case
+ // we need to drain it to get the
+ // Protocol::ProtocolStreamHeader_EndOfStream byte
+ // out of our connection stream.
+ char buffer[1];
+ int drained = rEncodedFile.Read(buffer, 1);
+ ASSERT(drained == 0);
// Write the attributes
stream->GetAttributes().WriteAttributes(DecodedFilename);