mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 18:25:30 +00:00
access list: don't delete old until new sucessfully created
This commit is contained in:
parent
ea52317b49
commit
4b96cfbdf9
1 changed files with 4 additions and 2 deletions
|
|
@ -60,12 +60,14 @@ impl AccessList {
|
||||||
let file = File::open(path)?;
|
let file = File::open(path)?;
|
||||||
let reader = BufReader::new(file);
|
let reader = BufReader::new(file);
|
||||||
|
|
||||||
self.0.clear();
|
let mut new_list = HashSet::new();
|
||||||
|
|
||||||
for line in reader.lines() {
|
for line in reader.lines() {
|
||||||
self.0.insert(Self::parse_line_to_info_hash(line?)?);
|
new_list.insert(Self::parse_line_to_info_hash(line?)?);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.0 = new_list;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue