mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
Add inline markers; simplify ip address conversion in request_from_bytes
This commit is contained in:
parent
4721fa3109
commit
a865f4a1ae
6 changed files with 15 additions and 6 deletions
|
|
@ -36,6 +36,7 @@ impl PeerStatus {
|
|||
/// Determine peer status from announce event and number of bytes left.
|
||||
///
|
||||
/// Likely, the last branch will be taken most of the time.
|
||||
#[inline]
|
||||
pub fn from_event_and_bytes_left(
|
||||
event: AnnounceEvent,
|
||||
bytes_left: NumberOfBytes
|
||||
|
|
@ -62,12 +63,14 @@ pub struct Peer {
|
|||
|
||||
|
||||
impl Peer {
|
||||
#[inline(always)]
|
||||
pub fn to_response_peer(&self) -> ResponsePeer {
|
||||
ResponsePeer {
|
||||
ip_address: self.ip_address,
|
||||
port: self.port
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn from_announce_and_ip(
|
||||
announce_request: &AnnounceRequest,
|
||||
ip_address: IpAddr
|
||||
|
|
|
|||
|
|
@ -214,6 +214,7 @@ pub fn extract_response_peers(
|
|||
}
|
||||
|
||||
|
||||
#[inline(always)]
|
||||
pub fn create_torrent_scrape_statistics(
|
||||
seeders: i32,
|
||||
leechers: i32
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue