From a1b98efe3d1c01f3763892829cafb50a4c57ece1 Mon Sep 17 00:00:00 2001 From: DecDuck Date: Wed, 3 Dec 2025 13:56:13 +1100 Subject: [PATCH] feat: re-enable multipart downloads --- src-tauri/games/src/downloads/download_agent.rs | 2 +- src-tauri/games/src/downloads/download_logic.rs | 17 +++-------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src-tauri/games/src/downloads/download_agent.rs b/src-tauri/games/src/downloads/download_agent.rs index 26b2acd..58fa08a 100644 --- a/src-tauri/games/src/downloads/download_agent.rs +++ b/src-tauri/games/src/downloads/download_agent.rs @@ -42,7 +42,7 @@ use super::drop_data::DropData; static RETRY_COUNT: usize = 3; const TARGET_BUCKET_SIZE: usize = 63 * 1000 * 1000; -const MAX_FILES_PER_BUCKET: usize = 1; // (1024 / 4) - 1; +const MAX_FILES_PER_BUCKET: usize = (1024 / 4) - 1; pub struct GameDownloadAgent { pub id: String, diff --git a/src-tauri/games/src/downloads/download_logic.rs b/src-tauri/games/src/downloads/download_logic.rs index 040097a..7916d2c 100644 --- a/src-tauri/games/src/downloads/download_logic.rs +++ b/src-tauri/games/src/downloads/download_logic.rs @@ -185,17 +185,10 @@ pub fn download_game_chunk( let header = generate_authorization_header(); - if bucket.drops.len() > 1 { - panic!("lol"); - } - - let drop = bucket.drops.first().unwrap(); - - let bits = ["/api/v1/depot/", &bucket.game_id, &bucket.version, &drop.id]; + let mut bits = vec!["/api/v1/depot/", &bucket.game_id, &bucket.version]; + bits.extend(bucket.drops.iter().map(|v| v.id.as_str())); let url = generate_url(&bits, &[]).unwrap(); - // let body = ChunkBody::create(ctx, &bucket.drops); - let response = DROP_CLIENT_SYNC .get(url) //.json(&body) @@ -218,7 +211,6 @@ pub fn download_game_chunk( RemoteAccessError::UnparseableResponse(raw_res), )); } - /* let lengths = response .headers() .get("Content-Lengths") @@ -240,9 +232,7 @@ pub fn download_game_chunk( RemoteAccessError::InvalidResponse(DropServerError { status_code: 400, status_message: "Server Error".to_owned(), - message: format!( - "invalid number of Content-Lengths recieved: {i}, {lengths}" - ), + message: format!("invalid number of Content-Lengths recieved: {i}, {lengths}"), }), )); }; @@ -263,7 +253,6 @@ pub fn download_game_chunk( )); } } - */ let timestep = start.elapsed().as_millis();