Print stats for each managed torrent now
This commit is contained in:
parent
218aa4d9ee
commit
d0757d41c5
2 changed files with 49 additions and 29 deletions
|
|
@ -22,15 +22,17 @@ use crate::{
|
|||
torrent_manager::{TorrentManagerBuilder, TorrentManagerHandle},
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum ManagedTorrentState {
|
||||
Initializing,
|
||||
Running(TorrentManagerHandle),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ManagedTorrent {
|
||||
info_hash: Id20,
|
||||
output_folder: PathBuf,
|
||||
state: ManagedTorrentState,
|
||||
pub info_hash: Id20,
|
||||
pub output_folder: PathBuf,
|
||||
pub state: ManagedTorrentState,
|
||||
}
|
||||
|
||||
impl PartialEq for ManagedTorrent {
|
||||
|
|
@ -167,6 +169,12 @@ impl Session {
|
|||
pub fn get_dht(&self) -> Option<Dht> {
|
||||
self.dht.clone()
|
||||
}
|
||||
pub fn with_torrents<F>(&self, callback: F)
|
||||
where
|
||||
F: Fn(&[ManagedTorrent]),
|
||||
{
|
||||
callback(&self.locked.read().torrents)
|
||||
}
|
||||
pub async fn add_torrent(
|
||||
&self,
|
||||
url: String,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue