src/tools/parallel_handler.rs: remove lifetime hacks, require 'static

In theory, one can do std::mem::forget, and ignore the drop handler. With
the lifetime hack, this could result in a crash.

So we simply require 'static lifetime now (futures also needs that).
This commit is contained in:
Dietmar Maurer
2020-10-01 14:48:49 +02:00
parent df766e668f
commit a71bc08ff4
3 changed files with 10 additions and 17 deletions

View File

@ -50,12 +50,13 @@ async fn pull_index_chunks<I: IndexFile>(
})
);
let target2 = target.clone();
let verify_pool = ParallelHandler::new(
"sync chunk writer", 4,
|(chunk, digest, size): (DataBlob, [u8;32], u64)| {
move |(chunk, digest, size): (DataBlob, [u8;32], u64)| {
// println!("verify and write {}", proxmox::tools::digest_to_hex(&digest));
chunk.verify_unencrypted(size as usize, &digest)?;
target.insert_chunk(&chunk, &digest)?;
target2.insert_chunk(&chunk, &digest)?;
Ok(())
}
);