mirror of
https://github.com/YGGverse/btracker.git
synced 2026-04-02 18:15:38 +00:00
use single hashmap index
This commit is contained in:
parent
1978a05a82
commit
25a71b0134
1 changed files with 6 additions and 8 deletions
12
src/main.rs
12
src/main.rs
|
|
@ -143,10 +143,7 @@ async fn main() -> Result<()> {
|
|||
{
|
||||
Ok(r) => match r {
|
||||
Ok(AddTorrentResponse::Added(id, mt)) => {
|
||||
let mut update_only_files: HashSet<usize> = HashSet::with_capacity(
|
||||
config.preload_max_filecount.unwrap_or_default(),
|
||||
);
|
||||
let mut images: HashMap<PathBuf, u64> = HashMap::with_capacity(
|
||||
let mut images: HashMap<PathBuf, usize> = HashMap::with_capacity(
|
||||
config.preload_max_filecount.unwrap_or_default(),
|
||||
);
|
||||
mt.wait_until_initialized().await?;
|
||||
|
|
@ -179,8 +176,7 @@ async fn main() -> Result<()> {
|
|||
}
|
||||
continue;
|
||||
}
|
||||
images.insert(info.relative_filename.clone(), info.len);
|
||||
assert!(update_only_files.insert(id))
|
||||
assert!(images.insert(info.relative_filename.clone(), id).is_none())
|
||||
}
|
||||
let mi = m.info.info();
|
||||
(
|
||||
|
|
@ -217,7 +213,9 @@ async fn main() -> Result<()> {
|
|||
m.torrent_bytes.clone().into()
|
||||
)
|
||||
})?;
|
||||
session.update_only_files(&mt, &update_only_files).await?;
|
||||
session
|
||||
.update_only_files(&mt, &images.values().collect())
|
||||
.await?;
|
||||
session.unpause(&mt).await?;
|
||||
mt.wait_until_completed().await?;
|
||||
assert!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue