mirror of
https://github.com/YGGverse/btracker.git
synced 2026-03-31 17:15:31 +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(r) => match r {
|
||||||
Ok(AddTorrentResponse::Added(id, mt)) => {
|
Ok(AddTorrentResponse::Added(id, mt)) => {
|
||||||
let mut update_only_files: HashSet<usize> = HashSet::with_capacity(
|
let mut images: HashMap<PathBuf, usize> = HashMap::with_capacity(
|
||||||
config.preload_max_filecount.unwrap_or_default(),
|
|
||||||
);
|
|
||||||
let mut images: HashMap<PathBuf, u64> = HashMap::with_capacity(
|
|
||||||
config.preload_max_filecount.unwrap_or_default(),
|
config.preload_max_filecount.unwrap_or_default(),
|
||||||
);
|
);
|
||||||
mt.wait_until_initialized().await?;
|
mt.wait_until_initialized().await?;
|
||||||
|
|
@ -179,8 +176,7 @@ async fn main() -> Result<()> {
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
images.insert(info.relative_filename.clone(), info.len);
|
assert!(images.insert(info.relative_filename.clone(), id).is_none())
|
||||||
assert!(update_only_files.insert(id))
|
|
||||||
}
|
}
|
||||||
let mi = m.info.info();
|
let mi = m.info.info();
|
||||||
(
|
(
|
||||||
|
|
@ -217,7 +213,9 @@ async fn main() -> Result<()> {
|
||||||
m.torrent_bytes.clone().into()
|
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?;
|
session.unpause(&mt).await?;
|
||||||
mt.wait_until_completed().await?;
|
mt.wait_until_completed().await?;
|
||||||
assert!(
|
assert!(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue