Skip to content

Commit 1e4de78

Browse files
committed
diskio: Correctly account the release of the final chunk
In incremental file processing we need to correctly account for the final chunk being released, otherwise we end up holding a chunk for the duration of the rest of the component for every incremental file in the tarball. This is what caused the issue surfaced in the previous commit, and thus this commit fixes #2774 Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
1 parent 60d206d commit 1e4de78

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/diskio/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,11 @@ pub(crate) fn write_file_incremental<P: AsRef<Path>, F: Fn(usize)>(
422422
let len = contents.len();
423423
// Length 0 vector is used for clean EOF signalling.
424424
if len == 0 {
425+
trace_scoped!("EOF_chunk", "name": path_display, "len": len);
426+
drop(contents);
427+
chunk_complete_callback(len);
425428
break;
426-
}
427-
{
429+
} else {
428430
trace_scoped!("write_segment", "name": path_display, "len": len);
429431
f.write_all(&contents)?;
430432
drop(contents);

0 commit comments

Comments
 (0)