@@ -223,7 +223,7 @@ impl Manifestation {
223223 // This is recommended in the official docs: https://docs.rs/tokio/latest/tokio/sync/index.html#mpsc-channel
224224 let total_components = components. len ( ) ;
225225 let ( download_tx, mut download_rx) =
226- mpsc:: channel :: < Result < ( ComponentBinary < ' _ > , File ) > > ( total_components) ;
226+ mpsc:: channel :: < Result < ( ComponentBinary , File ) > > ( total_components) ;
227227
228228 let semaphore = Arc :: new ( Semaphore :: new ( concurrent_downloads) ) ;
229229 let component_stream = tokio_stream:: iter ( components. into_iter ( ) ) . map ( {
@@ -287,20 +287,23 @@ impl Manifestation {
287287 let ( component_bin, installer_file) = message?;
288288 let component_name = component_bin. component . short_name ( & new_manifest) ;
289289 let notify_handler = Arc :: clone ( & download_cfg. notify_handler ) ;
290- current_tx = {
290+ current_tx = tokio :: task :: spawn_blocking ( {
291291 let this = Arc :: clone ( & self ) ;
292292 let new_manifest = Arc :: clone ( & new_manifest) ;
293293 let tmp_cx = Arc :: clone ( & download_cfg. tmp_cx ) ;
294294 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 ??;
304307 ( notify_handler) ( Notification :: ComponentInstalled (
305308 & component_name,
306309 & self . target_triple ,
@@ -566,7 +569,7 @@ impl Manifestation {
566569
567570 fn install_component (
568571 & self ,
569- component_bin : ComponentBinary < ' a > ,
572+ component_bin : ComponentBinary ,
570573 installer_file : File ,
571574 tmp_cx : Arc < temp:: Context > ,
572575 download_cfg : Arc < DownloadCfg > ,
@@ -803,7 +806,7 @@ impl Update {
803806 fn components_urls_and_hashes < ' a > (
804807 & ' a self ,
805808 new_manifest : & ' a Manifest ,
806- ) -> Result < Vec < ComponentBinary < ' a > > > {
809+ ) -> Result < Vec < ComponentBinary > > {
807810 let mut components_urls_and_hashes = Vec :: new ( ) ;
808811 for component in & self . components_to_install {
809812 let package = new_manifest. get_package ( component. short_name_in_manifest ( ) ) ?;
@@ -816,21 +819,21 @@ impl Update {
816819 // We prefer the first format in the list, since the parsing of the
817820 // manifest leaves us with the files/hash pairs in preference order.
818821 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 ( ) ) ,
821824 } ) ;
822825 }
823826
824827 Ok ( components_urls_and_hashes)
825828 }
826829}
827830
828- struct ComponentBinary < ' a > {
829- component : & ' a Component ,
830- binary : & ' a HashedBinary ,
831+ struct ComponentBinary {
832+ component : Arc < Component > ,
833+ binary : Arc < HashedBinary > ,
831834}
832835
833- impl < ' a > ComponentBinary < ' a > {
836+ impl ComponentBinary {
834837 async fn download (
835838 & self ,
836839 url : & Url ,
0 commit comments