Skip to content

Commit 1db9ffd

Browse files
committed
docs: Minor docs improvements & fixing doc linting errors
1 parent 2cb0cd7 commit 1db9ffd

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

crates/libtortillas/src/engine/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::{
2727

2828
pub(crate) enum EngineMessage {
2929
#[allow(dead_code)]
30-
/// Creates a new [Torrent](crate::torrent::Torrent) actor.
30+
/// Creates a new [Torrent] actor.
3131
Torrent(Box<MetaInfo>),
3232
/// Handles an incoming peer connection. The peer has been neither handshaked
3333
/// nor verified at this point.
@@ -57,7 +57,7 @@ pub struct Engine {
5757
torrents: Arc<DashMap<InfoHash, ActorRef<Torrent>>>,
5858
/// Our peer ID, used for the following actors "below" the engine.
5959
///
60-
/// - [Torrent](crate::torrent::Torrent)
60+
/// - [Torrent]
6161
/// - [PeerActor](crate::peer::PeerActor)
6262
/// - [TrackerActor](crate::tracker::TrackerActor)
6363
///

crates/libtortillas/src/torrent/mod.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,17 @@ impl Torrent {
7979
}
8080
}
8181

82-
/// Utility function that will create the peer actor and add it to the
83-
/// torrent.
82+
/// Spawns a new [`PeerActor`] for the given [`Peer`] and adds it to the
83+
/// torrent's peer set.
8484
///
85-
/// This function calls [Self::handshake_peer] if no stream is provided to
86-
/// retrieve the peer id
85+
/// - If a [`PeerStream`] is provided, a handshake is sent immediately.
86+
/// - If no stream is provided, this function attempts to connect to the peer
87+
/// and performs the handshake sequence inline.
88+
///
89+
/// The peer is ignored if:
90+
/// - The handshake fails,
91+
/// - The peer ID matches our own, or
92+
/// - The peer already exists in the peer set.
8793
#[instrument(skip(self, peer, stream), fields(%self, peer = ?peer.socket_addr()))]
8894
fn append_peer(&self, mut peer: Peer, stream: Option<PeerStream>) {
8995
let info_hash = Arc::new(self.info_hash());

crates/libtortillas/src/tracker/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ impl Actor for TrackerActor {
203203
type Args = (Tracker, PeerId, UdpServer, SocketAddr, ActorRef<Torrent>);
204204
type Error = TrackerActorError;
205205

206-
/// Unlike the [`PeerActor`](crate::protocol::PeerActor), there are no
206+
/// Unlike the [`PeerActor`](crate::peer::PeerActor), there are no
207207
/// prerequisites to calling this function. In other words, the tracker is
208208
/// not expected to be connected when this function is called.
209209
async fn on_start(state: Self::Args, _: ActorRef<Self>) -> Result<Self, Self::Error> {
@@ -285,7 +285,7 @@ pub(crate) enum TrackerMessage {
285285
/// requests are made on an interval.
286286
Announce,
287287
/// Gets the statistics of the tracker via
288-
/// [`tracker.stats()`](TrackerEnum::stats)
288+
/// [`tracker.stats()`](TrackerInstance::stats)
289289
GetStats,
290290
}
291291

crates/libtortillas/src/tracker/udp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,8 @@ impl UdpTracker {
710710
}
711711
}
712712

713-
/// Uses [send_message](UdpServer::send_message) to send a message and
714-
/// [recv_retry][UdpTracker::recv_retry] to receive the message.
713+
/// Uses [`UdpServer::send_message`] to send a message and
714+
/// [`UdpTracker::to_retry_error`] to receive the message.
715715
#[instrument(skip(self, message), fields(
716716
tracker_uri = %self.uri,
717717
connection_id = ?self.get_connection_id()

0 commit comments

Comments
 (0)