io: fix futures_io::AsyncSeek implementaion for Compat (#5783)

This commit is contained in:
Dhruv Vats
2023-06-25 13:04:35 +02:00
committed by GitHub
parent 6d25a00145
commit 910a1e2fcf
3 changed files with 46 additions and 0 deletions
+2
View File
@@ -227,6 +227,8 @@ impl<T: tokio::io::AsyncSeek> futures_io::AsyncSeek for Compat<T> {
pos: io::SeekFrom,
) -> Poll<io::Result<u64>> {
if self.seek_pos != Some(pos) {
// Ensure previous seeks have finished before starting a new one
ready!(self.as_mut().project().inner.poll_complete(cx))?;
self.as_mut().project().inner.start_seek(pos)?;
*self.as_mut().project().seek_pos = Some(pos);
}