Should be ready to test
This commit is contained in:
parent
d1c6a5b584
commit
eadb8872d9
2 changed files with 38 additions and 2 deletions
|
|
@ -7,7 +7,10 @@ use futures::Stream;
|
|||
use http::StatusCode;
|
||||
use librqbit_core::torrent_metainfo::TorrentMetaV1Info;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::sync::mpsc::UnboundedSender;
|
||||
use tokio::{
|
||||
io::{AsyncRead, AsyncSeek},
|
||||
sync::mpsc::UnboundedSender,
|
||||
};
|
||||
use tokio_stream::wrappers::{errors::BroadcastStreamRecvError, BroadcastStream};
|
||||
use tracing::warn;
|
||||
|
||||
|
|
@ -239,6 +242,11 @@ impl Api {
|
|||
let mgr = self.mgr_handle(idx)?;
|
||||
Ok(mgr.with_chunk_tracker(|chunks| format!("{:?}", chunks.get_have_pieces()))?)
|
||||
}
|
||||
|
||||
pub fn api_stream(&self, idx: TorrentId, file_id: usize) -> Result<impl AsyncRead + AsyncSeek> {
|
||||
let mgr = self.mgr_handle(idx)?;
|
||||
Ok(mgr.stream(file_id)?)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue