feat: implement BEP-53 support
This commit is contained in:
parent
60728f1699
commit
aa0c287fe5
4 changed files with 57 additions and 6 deletions
|
|
@ -868,7 +868,7 @@ impl Session {
|
|||
) -> BoxFuture<'a, anyhow::Result<AddTorrentResponse>> {
|
||||
async move {
|
||||
// Magnet links are different in that we first need to discover the metadata.
|
||||
let opts = opts.unwrap_or_default();
|
||||
let mut opts = opts.unwrap_or_default();
|
||||
|
||||
let paused = opts.list_only || opts.paused;
|
||||
|
||||
|
|
@ -885,6 +885,9 @@ impl Session {
|
|||
let info_hash = magnet
|
||||
.as_id20()
|
||||
.context("magnet link didn't contain a BTv1 infohash")?;
|
||||
if let Some(so) = magnet.get_select_only() {
|
||||
opts.only_files = Some(so);
|
||||
}
|
||||
|
||||
let peer_rx = self.make_peer_rx(
|
||||
info_hash,
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ impl SerializedTorrent {
|
|||
AddTorrent::TorrentFileBytes(self.torrent_bytes)
|
||||
} else {
|
||||
let magnet =
|
||||
Magnet::from_id20(self.info_hash, self.trackers.into_iter().collect()).to_string();
|
||||
Magnet::from_id20(self.info_hash, self.trackers.into_iter().collect(), self.only_files.clone()).to_string();
|
||||
AddTorrent::from_url(magnet)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ async fn _test_e2e_download(drop_checks: &DropChecks) {
|
|||
.and_then(|v| v.parse().ok())
|
||||
.unwrap_or(1usize);
|
||||
|
||||
let magnet = Magnet::from_id20(torrent_file.info_hash(), Vec::new()).to_string();
|
||||
let magnet = Magnet::from_id20(torrent_file.info_hash(), Vec::new(), None).to_string();
|
||||
|
||||
// 3. Start a client with the initial peers, and download the file.
|
||||
for _ in 0..client_iters {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue