Use concrete type for DHT peers
This commit is contained in:
parent
6243c5f02f
commit
210a3d5d3e
4 changed files with 15 additions and 14 deletions
|
|
@ -145,7 +145,7 @@ struct RecursiveRequest<C: RecursiveRequestCallbacks> {
|
|||
callbacks: C,
|
||||
}
|
||||
|
||||
struct RequestPeersStream {
|
||||
pub struct RequestPeersStream {
|
||||
rx: tokio::sync::mpsc::UnboundedReceiver<SocketAddr>,
|
||||
cancel_join_handle: tokio::task::JoinHandle<()>,
|
||||
}
|
||||
|
|
@ -959,10 +959,7 @@ impl DhtState {
|
|||
Ok(state)
|
||||
}
|
||||
|
||||
pub fn get_peers(
|
||||
self: &Arc<Self>,
|
||||
info_hash: Id20,
|
||||
) -> anyhow::Result<impl Stream<Item = SocketAddr> + Unpin> {
|
||||
pub fn get_peers(self: &Arc<Self>, info_hash: Id20) -> anyhow::Result<RequestPeersStream> {
|
||||
Ok(RequestPeersStream::new(self.clone(), info_hash))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use std::sync::Arc;
|
|||
use std::time::Duration;
|
||||
|
||||
pub use crate::dht::DhtStats;
|
||||
pub use crate::dht::{DhtConfig, DhtState};
|
||||
pub use crate::dht::{DhtConfig, DhtState, RequestPeersStream};
|
||||
pub use librqbit_core::id20::Id20;
|
||||
pub use persistence::{PersistentDht, PersistentDhtConfig};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue