Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Frando committed Aug 5, 2024
1 parent f9c076d commit 8aa6317
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions iroh-blobs/src/downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub trait Getter {

/// Trait modelling the intermediary state when a connection is needed to proceed.
pub trait NeedsConn<C>: std::fmt::Debug + 'static {
/// Proceeds the download with the given conneciton.
/// Proceeds the download with the given connection.
fn proceed(self, conn: C) -> GetProceedFut;
}

Expand All @@ -134,7 +134,7 @@ pub trait NeedsConn<C>: std::fmt::Debug + 'static {
pub enum GetOutput<N> {
/// The request is already complete in the local store.
Complete(Stats),
/// The request needs a connetion to continue.
/// The request needs a connection to continue.
NeedsConn(N),
}

Expand Down Expand Up @@ -1179,10 +1179,9 @@ impl<G: Getter<Connection = D::Connection>, D: Dialer> Service<G, D> {
// > this means that a super slow node would block a download from succeeding for a long
// > time, while faster nodes could be readily available.
// As a conclusion, timeouts should be added only after downloads are known to be bounded
let fut = get_state.proceed(conn);
let res = tokio::select! {
_ = cancellation.cancelled() => Err(FailureAction::AllIntentsDropped),
res = fut => res
res = get_state.proceed(conn) => res
};
trace!("transfer finished");

Expand Down
8 changes: 4 additions & 4 deletions iroh-blobs/src/get/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ pub async fn get_to_db<
db: &D,
get_conn: C,
hash_and_format: &HashAndFormat,
progress: impl ProgressSender<Msg = DownloadProgress> + IdGenerator,
progress_sender: impl ProgressSender<Msg = DownloadProgress> + IdGenerator,
) -> Result<Stats, GetError> {
match get_to_db_in_steps(db.clone(), *hash_and_format, progress).await? {
match get_to_db_in_steps(db.clone(), *hash_and_format, progress_sender).await? {
GetState::Complete(res) => Ok(res),
GetState::NeedsConn(state) => {
let conn = get_conn().await.map_err(GetError::Io)?;
Expand All @@ -86,10 +86,10 @@ pub async fn get_to_db_in_steps<
>(
db: D,
hash_and_format: HashAndFormat,
progress: P,
progress_sender: P,
) -> Result<GetState, GetError> {
let mut gen: GetGenerator = genawaiter::rc::Gen::new(move |co| {
let fut = async move { producer(co, &db, &hash_and_format, progress).await };
let fut = async move { producer(co, &db, &hash_and_format, progress_sender).await };
let fut: GetFuture = Box::pin(fut);
fut
});
Expand Down

0 comments on commit 8aa6317

Please sign in to comment.