Skip to content

Commit 50ed567

Browse files
committed
Dont restart completed files. 2.0.3 dev
1 parent c497659 commit 50ed567

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "engraver"
3-
version = "2.0.2"
3+
version = "2.0.3"
44
license = "GPL-3.0"
55
authors = ["PoC Consortium <bots@cryptoguru.org>"]
66
description = """

src/plotter.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,17 @@ impl Plotter {
173173
if !task.quiet {
174174
print!("File already exists, reading resume info...");
175175
}
176-
progress = read_resume_info(&file);
176+
let resume_info = read_resume_info(&file);
177+
match resume_info {
178+
Ok(x) => progress = x,
179+
Err(_) => {
180+
println!("Error");
181+
println!("File is already completed.");
182+
println!("Shutting Down...");
183+
return;
184+
185+
}
186+
}
177187
if !task.quiet {
178188
println!("OK");
179189
}

src/writer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub fn create_writer_task(
9292
}
9393
}
9494

95-
pub fn read_resume_info(file: &Path) -> u64 {
95+
pub fn read_resume_info(file: &Path) -> Result<u64,u64> {
9696
let mut file = open_r(&file).unwrap();
9797
file.seek(SeekFrom::End(-8)).unwrap();
9898

@@ -103,9 +103,9 @@ pub fn read_resume_info(file: &Path) -> u64 {
103103
file.read_exact(&mut double_monkey[0..4]).unwrap();
104104

105105
if double_monkey == [0xAF, 0xFE, 0xAF, 0xFE] {
106-
u64::from(as_u32_le(progress))
106+
Ok(u64::from(as_u32_le(progress)))
107107
} else {
108-
0
108+
Err(0)
109109
}
110110
}
111111

0 commit comments

Comments
 (0)