Add option to disable DHT

This commit is contained in:
Igor Katson 2021-07-13 14:02:47 +01:00
parent 1cd6caee76
commit d121efd4f4
2 changed files with 37 additions and 14 deletions

View file

@ -527,6 +527,13 @@ impl Dht {
}
pub async fn get_peers(&self, info_hash: Id20) -> impl StreamExt<Item = SocketAddr> {
let (tx, rx) = unbounded_channel::<Response>();
// This is a hack to test localhost speeds, uncomment to test that quickly.
//
// tx.send(Response::Peer("127.0.0.1:27311".parse().unwrap()))
// .unwrap();
// std::mem::forget(tx);
self.request_tx
.send((Request::GetPeers(info_hash), tx))
.await