From 2274dfecb4c014b1b30d5249d82fcd3eb3fc374b Mon Sep 17 00:00:00 2001 From: asonix Date: Wed, 5 Jul 2023 00:35:07 -0500 Subject: [PATCH] Fix io-uring - read_to_end was polling Stream mapped through StreamReader after completion --- src/file.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/file.rs b/src/file.rs index a0014c9..6ac8b1e 100644 --- a/src/file.rs +++ b/src/file.rs @@ -219,6 +219,7 @@ mod io_uring { Ok(()) } + #[tracing::instrument(level = "debug", skip_all)] pub(crate) async fn write_from_async_read( &mut self, mut reader: R, @@ -232,7 +233,7 @@ mod io_uring { let max_size = 65_536; let mut buf = Vec::with_capacity(max_size.try_into().unwrap()); - let n = (&mut reader).take(max_size).read_to_end(&mut buf).await?; + let n = (&mut reader).take(max_size).read_buf(&mut buf).await?; if n == 0 { break;