Skip to content

Commit

Permalink
cancelled download must be updated to bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
de-sh committed Apr 4, 2024
1 parent 08d8cab commit 41c574f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion uplink/src/base/bridge/actions_lane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,12 @@ impl ActionsBridge {
self.streams.forward(response.clone()).await;

if response.is_completed() || response.is_failed() {
self.clear_current_action();
if let Some(CurrentAction { cancelled_by: Some(cancel_action), .. }) =
self.current_action.take()
{
let response = ActionResponse::success(&cancel_action.action_id);
self.streams.forward(response).await;
}
return;
}

Expand Down
4 changes: 4 additions & 0 deletions uplink/src/collector/downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ pub enum Error {
BadSave,
#[error("Save file doesn't exist")]
NoSave,
#[error("Download has been cancelled")]
Cancelled,
}

/// This struct contains the necessary components to download and store file as notified by a download file
Expand Down Expand Up @@ -222,6 +224,8 @@ impl FileDownloader {

trace!("Deleting partially downloaded file: {cancellation:?}");
state.clean()?;

return Err(Error::Cancelled);
},

// NOTE: if download has timedout don't do anything, else ensure errors are forwarded after three retries
Expand Down

0 comments on commit 41c574f

Please sign in to comment.