From 4f98aedc41c41afa7ed0388ec838b96829d0577f Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 28 Apr 2007 19:57:24 +0000 Subject: 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) --- lib/backupclient/BackupStoreFile.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib') 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); -- cgit v1.2.3