diff --git a/src-tauri/src/downloads/download_agent.rs b/src-tauri/src/downloads/download_agent.rs index 093f1cc..4c43354 100644 --- a/src-tauri/src/downloads/download_agent.rs +++ b/src-tauri/src/downloads/download_agent.rs @@ -3,7 +3,7 @@ use crate::db::{DatabaseImpls, DATA_ROOT_DIR}; use crate::downloads::download_logic; use crate::downloads::manifest::{DropDownloadContext, DropManifest}; use crate::downloads::progress::ProgressChecker; -use crate::{AppState, DB}; +use crate::DB; use log::info; use rustix::fs::{fallocate, FallocateFlags}; use serde::{Deserialize, Serialize}; diff --git a/src-tauri/src/downloads/download_commands.rs b/src-tauri/src/downloads/download_commands.rs index 550d837..3bae4bb 100644 --- a/src-tauri/src/downloads/download_commands.rs +++ b/src-tauri/src/downloads/download_commands.rs @@ -56,7 +56,7 @@ pub async fn start_game_downloads( } }); info!("Spawned download"); - return Ok(()) + Ok(()) } pub fn start_game_download( @@ -92,5 +92,5 @@ pub async fn stop_specific_game_download(state: tauri::State<'_, Mutex info!("Stopping callback"); callback.store(true, Ordering::Release); - return Ok(()) + Ok(()) } \ No newline at end of file diff --git a/src-tauri/src/downloads/download_logic.rs b/src-tauri/src/downloads/download_logic.rs index d432780..f00cbfc 100644 --- a/src-tauri/src/downloads/download_logic.rs +++ b/src-tauri/src/downloads/download_logic.rs @@ -2,11 +2,10 @@ use crate::auth::generate_authorization_header; use crate::db::DatabaseImpls; use crate::downloads::manifest::DropDownloadContext; use crate::DB; -use gxhash::{gxhash128, GxHasher}; use log::info; use md5::{Context, Digest}; use reqwest::blocking::Response; -use std::{fs::{File, OpenOptions}, hash::Hasher, io::{self, BufReader, BufWriter, Error, ErrorKind, Read, Seek, SeekFrom, Write}, path::PathBuf, sync::{atomic::{AtomicBool, Ordering}, Arc}}; +use std::{fs::{File, OpenOptions}, io::{self, Error, ErrorKind, Read, Seek, SeekFrom, Write}, path::PathBuf, sync::{atomic::{AtomicBool, Ordering}, Arc}}; use urlencoding::encode; pub struct DropFileWriter { @@ -101,24 +100,4 @@ pub fn download_game_chunk(ctx: DropDownloadContext, callback: Arc) } // stream.flush().unwrap(); -} - -pub fn copy_to_drop_file_writer(response: &mut Response, writer: &mut DropFileWriter) { - loop { - info!("Writing to file writer"); - let mut buf = [0u8; 1024]; - response.read(&mut buf).unwrap(); - match writer.write_all(&buf) { - Ok(_) => {}, - Err(e) => { - match e.kind() { - ErrorKind::Interrupted => { - info!("Interrupted"); - return; - } - _ => { println!("{}", e); return;} - } - }, - } - } } \ No newline at end of file diff --git a/src-tauri/src/downloads/manifest.rs b/src-tauri/src/downloads/manifest.rs index 895d3ab..9393f8b 100644 --- a/src-tauri/src/downloads/manifest.rs +++ b/src-tauri/src/downloads/manifest.rs @@ -1,8 +1,6 @@ use serde::{Deserialize, Serialize}; use std::collections::HashMap; -use std::fs::File; use std::path::PathBuf; -use std::sync::{Arc, Mutex}; pub type DropManifest = HashMap; #[derive(Serialize, Deserialize, Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]