Merge pull request #72 from jabedude/bep52-magnet-support

Add support for BTv2 magnet links
This commit is contained in:
Igor Katson 2024-01-08 11:27:27 +00:00 committed by GitHub
commit c8189de3d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 236 additions and 157 deletions

View file

@ -63,7 +63,7 @@ use clone_to_owned::CloneToOwned;
use futures::{stream::FuturesUnordered, StreamExt};
use itertools::Itertools;
use librqbit_core::{
id20::Id20,
hash_id::Id20,
lengths::{ChunkInfo, Lengths, ValidPieceIndex},
spawn_utils::spawn_with_cancel,
speed_estimator::SpeedEstimator,
@ -383,7 +383,7 @@ impl TorrentStateLive {
let peer = occ.get_mut();
peer.state
.incoming_connection(
Id20(checked_peer.handshake.peer_id),
Id20::new(checked_peer.handshake.peer_id),
tx.clone(),
&self.peers.stats,
)
@ -393,7 +393,7 @@ impl TorrentStateLive {
Entry::Vacant(vac) => {
atomic_inc(&self.peers.stats.seen);
let peer = Peer::new_live_for_incoming_connection(
Id20(checked_peer.handshake.peer_id),
Id20::new(checked_peer.handshake.peer_id),
tx.clone(),
&self.peers.stats,
);
@ -597,7 +597,7 @@ impl TorrentStateLive {
fn set_peer_live<B>(&self, handle: PeerHandle, h: Handshake<B>) {
self.peers.with_peer_mut(handle, "set_peer_live", |p| {
p.state
.connecting_to_live(Id20(h.peer_id), &self.peers.stats);
.connecting_to_live(Id20::new(h.peer_id), &self.peers.stats);
});
}

View file

@ -2,7 +2,7 @@ pub mod stats;
use std::collections::HashSet;
use librqbit_core::id20::Id20;
use librqbit_core::hash_id::Id20;
use librqbit_core::lengths::{ChunkInfo, ValidPieceIndex};
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};

View file

@ -16,7 +16,7 @@ use anyhow::bail;
use anyhow::Context;
use buffers::ByteString;
use dht::RequestPeersStream;
use librqbit_core::id20::Id20;
use librqbit_core::hash_id::Id20;
use librqbit_core::lengths::Lengths;
use librqbit_core::peer_id::generate_peer_id;