Skip to content

Commit

Permalink
docs(http): add comment for duplicate struct info
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Mar 2, 2023
1 parent 2ddefa8 commit ee5b088
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/tracker/torrent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ pub struct Entry {
pub completed: u32,
}

/// Swarm metadata dictionary in the scrape response.
/// BEP 48: <https://www.bittorrent.org/beps/bep_0048.html>
#[derive(Debug, PartialEq, Default)]
pub struct SwarmMetadata {
pub complete: u32, // The number of active peers that have completed downloading (seeders)
Expand All @@ -28,6 +30,14 @@ impl SwarmMetadata {
}
}

/// Swarm statistics. Alternative struct for swarm metadata in scrape response.
#[derive(Debug)]
pub struct SwamStats {
pub completed: u32, // The number of peers that have ever completed downloading
pub seeders: u32, // The number of active peers that have completed downloading (seeders)
pub leechers: u32, // The number of active peers that have not completed downloading (leechers)
}

impl Entry {
#[must_use]
pub fn new() -> Entry {
Expand Down Expand Up @@ -111,13 +121,6 @@ impl Default for Entry {
}
}

#[derive(Debug)]
pub struct SwamStats {
pub completed: u32,
pub seeders: u32,
pub leechers: u32,
}

#[cfg(test)]
mod tests {

Expand Down

0 comments on commit ee5b088

Please sign in to comment.