@@ -223,7 +223,7 @@ impl Manifestation {
223
223
// This is recommended in the official docs: https://docs.rs/tokio/latest/tokio/sync/index.html#mpsc-channel
224
224
let total_components = components. len ( ) ;
225
225
let ( download_tx, mut download_rx) =
226
- mpsc:: channel :: < Result < ( ComponentBinary < ' _ > , File ) > > ( total_components) ;
226
+ mpsc:: channel :: < Result < ( ComponentBinary , File ) > > ( total_components) ;
227
227
228
228
let semaphore = Arc :: new ( Semaphore :: new ( concurrent_downloads) ) ;
229
229
let component_stream = tokio_stream:: iter ( components. into_iter ( ) ) . map ( {
@@ -287,20 +287,23 @@ impl Manifestation {
287
287
let ( component_bin, installer_file) = message?;
288
288
let component_name = component_bin. component . short_name ( & new_manifest) ;
289
289
let notify_handler = Arc :: clone ( & download_cfg. notify_handler ) ;
290
- current_tx = {
290
+ current_tx = tokio :: task :: spawn_blocking ( {
291
291
let this = Arc :: clone ( & self ) ;
292
292
let new_manifest = Arc :: clone ( & new_manifest) ;
293
293
let tmp_cx = Arc :: clone ( & download_cfg. tmp_cx ) ;
294
294
let download_cfg = Arc :: clone ( & download_cfg) ;
295
- this. install_component (
296
- component_bin,
297
- installer_file,
298
- tmp_cx,
299
- download_cfg,
300
- new_manifest,
301
- current_tx,
302
- )
303
- } ?;
295
+ move || {
296
+ this. install_component (
297
+ component_bin,
298
+ installer_file,
299
+ tmp_cx,
300
+ download_cfg,
301
+ new_manifest,
302
+ current_tx,
303
+ )
304
+ }
305
+ } )
306
+ . await ??;
304
307
( notify_handler) ( Notification :: ComponentInstalled (
305
308
& component_name,
306
309
& self . target_triple ,
@@ -566,7 +569,7 @@ impl Manifestation {
566
569
567
570
fn install_component (
568
571
& self ,
569
- component_bin : ComponentBinary < ' a > ,
572
+ component_bin : ComponentBinary ,
570
573
installer_file : File ,
571
574
tmp_cx : Arc < temp:: Context > ,
572
575
download_cfg : Arc < DownloadCfg > ,
@@ -803,7 +806,7 @@ impl Update {
803
806
fn components_urls_and_hashes < ' a > (
804
807
& ' a self ,
805
808
new_manifest : & ' a Manifest ,
806
- ) -> Result < Vec < ComponentBinary < ' a > > > {
809
+ ) -> Result < Vec < ComponentBinary > > {
807
810
let mut components_urls_and_hashes = Vec :: new ( ) ;
808
811
for component in & self . components_to_install {
809
812
let package = new_manifest. get_package ( component. short_name_in_manifest ( ) ) ?;
@@ -816,21 +819,21 @@ impl Update {
816
819
// We prefer the first format in the list, since the parsing of the
817
820
// manifest leaves us with the files/hash pairs in preference order.
818
821
components_urls_and_hashes. push ( ComponentBinary {
819
- component,
820
- binary : & target_package. bins [ 0 ] ,
822
+ component : Arc :: new ( component . clone ( ) ) ,
823
+ binary : Arc :: new ( target_package. bins [ 0 ] . clone ( ) ) ,
821
824
} ) ;
822
825
}
823
826
824
827
Ok ( components_urls_and_hashes)
825
828
}
826
829
}
827
830
828
- struct ComponentBinary < ' a > {
829
- component : & ' a Component ,
830
- binary : & ' a HashedBinary ,
831
+ struct ComponentBinary {
832
+ component : Arc < Component > ,
833
+ binary : Arc < HashedBinary > ,
831
834
}
832
835
833
- impl < ' a > ComponentBinary < ' a > {
836
+ impl ComponentBinary {
834
837
async fn download (
835
838
& self ,
836
839
url : & Url ,
0 commit comments