diff --git a/src-tauri/src/download_manager/download_manager_builder.rs b/src-tauri/src/download_manager/download_manager_builder.rs index eeaaeae..406a500 100644 --- a/src-tauri/src/download_manager/download_manager_builder.rs +++ b/src-tauri/src/download_manager/download_manager_builder.rs @@ -238,6 +238,7 @@ impl DownloadManagerBuilder { sender.send(DownloadManagerSignal::Error(e)).unwrap(); }, } + sender.send(DownloadManagerSignal::UpdateUIQueue).unwrap(); })); self.set_status(DownloadManagerStatus::Downloading); diff --git a/src-tauri/src/games/downloads/download_agent.rs b/src-tauri/src/games/downloads/download_agent.rs index 942cf4a..5a92380 100644 --- a/src-tauri/src/games/downloads/download_agent.rs +++ b/src-tauri/src/games/downloads/download_agent.rs @@ -249,6 +249,7 @@ impl GameDownloadAgent { let base_url = DB.fetch_base_url(); + let contexts = self.contexts.lock().unwrap(); pool.scope(|scope| { let client = &reqwest::blocking::Client::new(); @@ -288,6 +289,7 @@ impl GameDownloadAgent { let newly_completed = completed_indexes.to_owned(); + let completed_lock_len = { let mut completed_contexts_lock = self.completed_contexts.lock().unwrap(); for (item, _) in newly_completed.iter() { @@ -297,8 +299,10 @@ impl GameDownloadAgent { completed_contexts_lock.len() }; + info!("Got newly completed"); + // If we're not out of contexts, we're not done, so we don't fire completed - if completed_lock_len != self.contexts.lock().unwrap().len() { + if completed_lock_len != contexts.len() { info!("da for {} exited without completing", self.id.clone()); self.stored_manifest .set_completed_contexts(&self.completed_contexts.lock().unwrap().clone().into()); @@ -308,6 +312,9 @@ impl GameDownloadAgent { return Ok(false); } + info!("Sending completed signal"); + + // We've completed self.sender .send(DownloadManagerSignal::Completed(self.metadata())) diff --git a/src-tauri/src/games/downloads/download_logic.rs b/src-tauri/src/games/downloads/download_logic.rs index a14756d..fba28ad 100644 --- a/src-tauri/src/games/downloads/download_logic.rs +++ b/src-tauri/src/games/downloads/download_logic.rs @@ -6,7 +6,7 @@ use crate::download_manager::progress_object::ProgressHandle; use crate::games::downloads::manifest::DropDownloadContext; use crate::remote::RemoteAccessError; use crate::DB; -use log::{info, warn}; +use log::{error, info, warn}; use md5::{Context, Digest}; use reqwest::blocking::{Client, Request, RequestBuilder, Response}; @@ -153,6 +153,7 @@ pub fn download_game_chunk( let content_length = response.content_length(); if content_length.is_none() { + error!("Recieved 0 length content from server"); return Err(ApplicationDownloadError::Communication( RemoteAccessError::InvalidResponse, ));