Fastresume CLI option

This commit is contained in:
Igor Katson 2024-08-20 21:47:08 +01:00
parent e11744cd63
commit 65feec3406
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
3 changed files with 8 additions and 2 deletions

View file

@ -20,7 +20,7 @@ devserver:
echo -n '' > /tmp/rqbit-log && cargo run -- \ echo -n '' > /tmp/rqbit-log && cargo run -- \
--log-file /tmp/rqbit-log \ --log-file /tmp/rqbit-log \
--log-file-rust-log=debug,librqbit=trace \ --log-file-rust-log=debug,librqbit=trace \
server start /tmp/scratch/ server start --fastresume /tmp/scratch/
@PHONY: devserver @PHONY: devserver
devserver-postgres: devserver-postgres:

View file

@ -152,7 +152,7 @@ impl TorrentStateLocked {
if self.unflushed_bitv_bytes == 0 { if self.unflushed_bitv_bytes == 0 {
return; return;
} }
trace!("trying to flush bitfield");
if let Some(Err(e)) = self if let Some(Err(e)) = self
.chunks .chunks
.as_mut() .as_mut()

View file

@ -143,6 +143,10 @@ struct ServerStartOptions {
/// The folder to store session data in. By default uses OS specific folder. /// The folder to store session data in. By default uses OS specific folder.
#[arg(long = "persistence-config")] #[arg(long = "persistence-config")]
persistence_config: Option<String>, persistence_config: Option<String>,
/// [Experimental] if set, will try to resume quickly after restart and skip checksumming.
#[arg(long = "fastresume")]
fastresume: bool,
} }
#[derive(Parser)] #[derive(Parser)]
@ -422,6 +426,8 @@ async fn async_main(opts: Opts) -> anyhow::Result<()> {
} }
} }
sopts.fastresume = start_opts.fastresume;
let session = let session =
Session::new_with_opts(PathBuf::from(&start_opts.output_folder), sopts) Session::new_with_opts(PathBuf::from(&start_opts.output_folder), sopts)
.await .await