This commit is contained in:
sxyazi 2025-12-01 22:39:07 +08:00
parent b85dfe22b2
commit 6c7fdd36fc
No known key found for this signature in database
2 changed files with 8 additions and 8 deletions

View file

@ -53,14 +53,14 @@ pub(super) fn copy_with_progress_impl(
let (done_tx, mut done_rx) = oneshot::channel(); let (done_tx, mut done_rx) = oneshot::channel();
tokio::spawn({ tokio::spawn({
let (from, to) = (from.to_owned(), to.to_owned()); let to = to.to_owned();
async move { async move {
done_tx.send(copy_impl(from, to, attrs).await).ok(); done_tx.send(copy_impl(from, to, attrs).await).ok();
} }
}); });
tokio::spawn({ tokio::spawn({
let (prog_tx, to) = (prog_tx.clone(), to.to_owned()); let prog_tx = prog_tx.clone();
async move { async move {
let mut last = 0; let mut last = 0;
let mut done = None; let mut done = None;

View file

@ -100,11 +100,11 @@ impl AsyncSeek for File {
self.seek_rx = Some(match position { self.seek_rx = Some(match position {
SeekFrom::Start(n) => SeekState::NonBlocking(n), SeekFrom::Start(n) => SeekState::NonBlocking(n),
SeekFrom::Current(n) => { SeekFrom::Current(n) => self
self.cursor.checked_add_signed(n).map(SeekState::NonBlocking).ok_or_else(|| { .cursor
io::Error::other("seeking to a negative position or overflowed position") .checked_add_signed(n)
})? .map(SeekState::NonBlocking)
} .ok_or_else(|| io::Error::other("seeking to a negative or overflowed position"))?,
SeekFrom::End(n) => SeekState::Blocking( SeekFrom::End(n) => SeekState::Blocking(
n, n,
timeout( timeout(
@ -148,7 +148,7 @@ impl AsyncSeek for File {
Ready( Ready(
size size
.checked_add_signed(*n) .checked_add_signed(*n)
.ok_or_else(|| io::Error::other("seeking to a negative position or overflowed position")), .ok_or_else(|| io::Error::other("seeking to a negative or overflowed position")),
) )
} }