Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: avoid possible panic when verifying
The chunk iterator ends when either the channel is closed, or a slot is left unfinished. Unfortunately, the reader was _always_ leaving a slot unfinished: after the final block was read, the reader would get another slot, read zero bytes to see the EOF, and drop the slot without filling it. This meant the writer would see the chunk iterator end when the slot was dropped, which meant the reader thread may not have gotten around to dropping the original file: the writer thread was assuming a finished iterator meant the channel was closed, but this was not the case. So instead, check if we should expect we read the final block, and don't reserve a slot in that case to check if there's no more to read. There's a more complete fix coming, but this will fix most realistic errors.
- Loading branch information