Add examples
This commit is contained in:
parent
adb98a2d89
commit
2ebbc0a828
9 changed files with 541 additions and 30 deletions
|
|
@ -251,7 +251,10 @@ impl Session {
|
|||
torrent_from_file(url)?
|
||||
};
|
||||
let dht_rx = match self.dht.as_ref() {
|
||||
Some(dht) => Some(dht.get_peers(torrent.info_hash).await?),
|
||||
Some(dht) => {
|
||||
debug!("reading peers for {:?} from DHT", torrent.info_hash);
|
||||
Some(dht.get_peers(torrent.info_hash).await?)
|
||||
}
|
||||
None => None,
|
||||
};
|
||||
let trackers = torrent
|
||||
|
|
|
|||
|
|
@ -38,3 +38,14 @@ impl BlockingSpawner {
|
|||
f()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for BlockingSpawner {
|
||||
fn default() -> Self {
|
||||
let allow_block_in_place = match tokio::runtime::Handle::current().runtime_flavor() {
|
||||
tokio::runtime::RuntimeFlavor::CurrentThread => false,
|
||||
tokio::runtime::RuntimeFlavor::MultiThread => true,
|
||||
_ => true,
|
||||
};
|
||||
Self::new(allow_block_in_place)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue