Skip to content

Commit

Permalink
fixup: tell() isn't helpful for OutOfData case
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasWaldmann committed Jun 23, 2018
1 parent 985fa9f commit 3959a7b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/borg/fuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,15 @@ def iter_archive_items(self, archive_item_ids, filter=None, consider_part_files=
while True:
try:
item = unpacker.unpack()
need_more_data = False
except msgpack.OutOfData:
need_more_data = True
else:
need_more_data = False

start = stream_offset - chunk_begin
length = unpacker.tell() - stream_offset
stream_offset = stream_offset + length # == tell()
# tell() is not helpful for the need_more_data case, but we know it is the remainder
# of the data in that case. in the other case, tell() works as expected.
length = (len(data) - start) if need_more_data else (unpacker.tell() - stream_offset)
stream_offset += length
msgpacked_bytes += data[start:start+length]

if need_more_data:
Expand Down

0 comments on commit 3959a7b

Please sign in to comment.