src/client/http_client.rs: use start of chunk as offset

This commit is contained in:
Dietmar Maurer 2019-05-28 09:01:01 +02:00
parent 8de20e5c1f
commit 3dc5b2a203
2 changed files with 5 additions and 3 deletions

View File

@ -158,14 +158,15 @@ impl BackupEnvironment {
None => bail!("dynamic writer '{}' not registered", wid),
};
data.offset += size as u64;
data.chunk_count += 1;
if data.offset != offset {
bail!("dynamic writer '{}' append chunk failed - got strange chunk offset ({} != {})",
data.name, data.offset, offset);
}
data.offset += size as u64;
data.chunk_count += 1;
data.index.add_chunk(data.offset, digest)?;
Ok(())

View File

@ -445,8 +445,9 @@ impl BackupClient {
let stream = stream.
map(move |data| {
let digest = openssl::sha::sha256(&data);
let offset = stream_len;
stream_len += data.len() as u64;
ChunkInfo { data, digest, offset: stream_len }
ChunkInfo { data, digest, offset }
});
let h2 = self.h2.clone();