mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 18:55:32 +00:00
bittorrent_udp: improve code formatting and imports
This commit is contained in:
parent
fe85901021
commit
b32046e768
4 changed files with 41 additions and 43 deletions
|
|
@ -1,23 +1,23 @@
|
|||
use crate::types;
|
||||
use crate::types::AnnounceEvent;
|
||||
|
||||
|
||||
#[inline]
|
||||
pub fn event_from_i32(i: i32) -> types::AnnounceEvent {
|
||||
pub fn event_from_i32(i: i32) -> AnnounceEvent {
|
||||
match i {
|
||||
1 => types::AnnounceEvent::Completed,
|
||||
2 => types::AnnounceEvent::Started,
|
||||
3 => types::AnnounceEvent::Stopped,
|
||||
_ => types::AnnounceEvent::None
|
||||
1 => AnnounceEvent::Completed,
|
||||
2 => AnnounceEvent::Started,
|
||||
3 => AnnounceEvent::Stopped,
|
||||
_ => AnnounceEvent::None
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[inline]
|
||||
pub fn event_to_i32(event: types::AnnounceEvent) -> i32 {
|
||||
pub fn event_to_i32(event: AnnounceEvent) -> i32 {
|
||||
match event {
|
||||
types::AnnounceEvent::None => 0,
|
||||
types::AnnounceEvent::Completed => 1,
|
||||
types::AnnounceEvent::Started => 2,
|
||||
types::AnnounceEvent::Stopped => 3
|
||||
AnnounceEvent::None => 0,
|
||||
AnnounceEvent::Completed => 1,
|
||||
AnnounceEvent::Started => 2,
|
||||
AnnounceEvent::Stopped => 3
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
use std::net;
|
||||
|
||||
use std::net::IpAddr;
|
||||
|
||||
|
||||
#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]
|
||||
|
|
@ -45,7 +44,7 @@ pub struct PeerKey (pub u32);
|
|||
|
||||
#[derive(Hash, PartialEq, Eq, Clone, Debug)]
|
||||
pub struct ResponsePeer {
|
||||
pub ip_address: net::IpAddr,
|
||||
pub ip_address: IpAddr,
|
||||
pub port: Port,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use super::common::*;
|
||||
|
||||
|
||||
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub struct TorrentScrapeStatistics {
|
||||
pub seeders: NumberOfPeers,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue