Session persistence
This commit is contained in:
parent
e467787c38
commit
bec5e1be7f
7 changed files with 204 additions and 51 deletions
|
|
@ -85,7 +85,7 @@ pub struct ManagedTorrentInfo {
|
|||
|
||||
pub struct ManagedTorrent {
|
||||
pub info: Arc<ManagedTorrentInfo>,
|
||||
only_files: Option<Vec<usize>>,
|
||||
pub(crate) only_files: Option<Vec<usize>>,
|
||||
locked: RwLock<ManagedTorrentLocked>,
|
||||
}
|
||||
|
||||
|
|
@ -138,6 +138,7 @@ impl ManagedTorrent {
|
|||
self: &Arc<Self>,
|
||||
initial_peers: Vec<SocketAddr>,
|
||||
peer_rx: Option<impl StreamExt<Item = SocketAddr> + Unpin + Send + Sync + 'static>,
|
||||
start_paused: bool,
|
||||
) -> anyhow::Result<()> {
|
||||
let mut g = self.locked.write();
|
||||
|
||||
|
|
@ -185,6 +186,11 @@ impl ManagedTorrent {
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
if start_paused {
|
||||
g.state = ManagedTorrentState::Paused(paused);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let live = TorrentStateLive::new(paused);
|
||||
g.state = ManagedTorrentState::Live(live.clone());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue