feat(downloads): Added AgentInterfaceData to get information about all downloads in queue

Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
quexeky
2024-11-16 17:03:37 +11:00
parent f029cbf0b3
commit 63c3cc1096
8 changed files with 98 additions and 44 deletions

View File

@ -28,7 +28,7 @@ pub struct GameDownloadAgent {
pub progress: ProgressObject,
}
#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum GameDownloadError {
CommunicationError(RemoteAccessError),
ChecksumError,
@ -50,11 +50,11 @@ impl Display for GameDownloadError {
impl GameDownloadAgent {
pub fn new(id: String, version: String, target_download_dir: usize) -> Self {
// Don't run by default
let status = DownloadThreadControl::new(DownloadThreadControlFlag::Stop);
let control_flag = DownloadThreadControl::new(DownloadThreadControlFlag::Stop);
Self {
id,
version,
control_flag: status.clone(),
control_flag,
manifest: Mutex::new(None),
target_download_dir,
contexts: Mutex::new(Vec::new()),
@ -207,6 +207,7 @@ impl GameDownloadAgent {
.build()
.unwrap();
pool.scope(move |scope| {
let contexts = self.contexts.lock().unwrap();