access list: don't delete old until new sucessfully created

This commit is contained in:
Joakim Frostegård 2021-10-15 02:44:05 +02:00
parent ea52317b49
commit 4b96cfbdf9

View file

@ -60,12 +60,14 @@ impl AccessList {
let file = File::open(path)?;
let reader = BufReader::new(file);
self.0.clear();
let mut new_list = HashSet::new();
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(())
}