fix(tvix/nix-compat): use buf.filled()
to track read bytes
We were wrongly using `buf.initialized()` which contains more than the filled portion to compute the number of bytes read during a poll call. This made us go into the trailer reading state too early and finally failing due to invalid trailer data. Fixes b/405. Co-authored-by: Florian Klink <flokli@flokli.de> Change-Id: I66ba6e2116389e6b97305f85c4e0922195000e45 Signed-off-by: Ryan Lahfa <tvl@lahfa.xyz> Reviewed-on: https://cl.tvl.fyi/c/depot/+/11978 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de> Reviewed-by: edef <edef@edef.eu>
This commit is contained in:
parent
168e4fda59
commit
f0b0a6572f
1 changed files with 1 additions and 1 deletions
|
@ -152,7 +152,7 @@ impl<R: AsyncRead + Unpin, T: Tag> AsyncRead for BytesReader<R, T> {
|
||||||
let mut bytes_read = 0;
|
let mut bytes_read = 0;
|
||||||
ready!(with_limited(buf, remaining, |buf| {
|
ready!(with_limited(buf, remaining, |buf| {
|
||||||
let ret = reader.poll_read(cx, buf);
|
let ret = reader.poll_read(cx, buf);
|
||||||
bytes_read = buf.initialized().len();
|
bytes_read = buf.filled().len();
|
||||||
ret
|
ret
|
||||||
}))?;
|
}))?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue