Fix a couple bugs

This commit is contained in:
Igor Katson 2023-11-25 11:21:45 +00:00
parent 1bea1f9235
commit 1c53aeba2f
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
6 changed files with 57 additions and 30 deletions

View file

@ -210,6 +210,8 @@ pub struct SessionOptions {
pub disable_dht: bool,
pub disable_dht_persistence: bool,
pub persistence: bool,
// Will default to output_folder/.rqbit-session.json
pub persistence_filename: Option<PathBuf>,
pub dht_config: Option<PersistentDhtConfig>,
pub peer_id: Option<Id20>,
pub peer_opts: Option<PeerConnectionOptions>,
@ -240,7 +242,9 @@ impl Session {
Some(dht)
};
let peer_opts = opts.peer_opts.unwrap_or_default();
let session_filename = output_folder.join(".rqbit-session.json");
let session_filename = opts
.persistence_filename
.unwrap_or_else(|| output_folder.join(".rqbit-session.json"));
let session = Arc::new(Self {
persistence_filename: session_filename,
peer_id,