From 66232df6d2253449ce7510cf4e4228573dfb9641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Fri, 18 Mar 2022 15:47:14 +0100 Subject: [PATCH] ws: remove pub visibility where not needed --- aquatic_ws/src/lib.rs | 4 ++-- aquatic_ws/src/workers/request.rs | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/aquatic_ws/src/lib.rs b/aquatic_ws/src/lib.rs index 0e8cd38..4b6c9ad 100644 --- a/aquatic_ws/src/lib.rs +++ b/aquatic_ws/src/lib.rs @@ -54,7 +54,7 @@ pub fn run(config: Config) -> ::anyhow::Result<()> { Ok(()) } -pub fn run_workers(config: Config, state: State) -> anyhow::Result<()> { +fn run_workers(config: Config, state: State) -> anyhow::Result<()> { let num_peers = config.socket_workers + config.request_workers; let request_mesh_builder = MeshBuilder::partial(num_peers, SHARED_IN_CHANNEL_SIZE); @@ -150,7 +150,7 @@ pub fn run_workers(config: Config, state: State) -> anyhow::Result<()> { Ok(()) } -pub fn create_tls_config(config: &Config) -> anyhow::Result { +fn create_tls_config(config: &Config) -> anyhow::Result { let certs = { let f = File::open(&config.network.tls_certificate_path)?; let mut f = BufReader::new(f); diff --git a/aquatic_ws/src/workers/request.rs b/aquatic_ws/src/workers/request.rs index 6cf2ca0..c9adc36 100644 --- a/aquatic_ws/src/workers/request.rs +++ b/aquatic_ws/src/workers/request.rs @@ -20,7 +20,7 @@ use crate::config::Config; use crate::SHARED_IN_CHANNEL_SIZE; #[derive(PartialEq, Eq, Clone, Copy, Debug)] -pub enum PeerStatus { +enum PeerStatus { Seeding, Leeching, Stopped, @@ -31,7 +31,7 @@ impl PeerStatus { /// /// Likely, the last branch will be taken most of the time. #[inline] - pub fn from_event_and_bytes_left(event: AnnounceEvent, opt_bytes_left: Option) -> Self { + fn from_event_and_bytes_left(event: AnnounceEvent, opt_bytes_left: Option) -> Self { if let AnnounceEvent::Stopped = event { Self::Stopped } else if let Some(0) = opt_bytes_left { @@ -43,15 +43,15 @@ impl PeerStatus { } #[derive(Clone, Copy)] -pub struct Peer { +struct Peer { pub connection_meta: ConnectionMeta, pub status: PeerStatus, pub valid_until: ValidUntil, } -pub type PeerMap = AHashIndexMap; +type PeerMap = AHashIndexMap; -pub struct TorrentData { +struct TorrentData { pub peers: PeerMap, pub num_seeders: usize, pub num_leechers: usize, @@ -68,16 +68,16 @@ impl Default for TorrentData { } } -pub type TorrentMap = AHashIndexMap; +type TorrentMap = AHashIndexMap; #[derive(Default)] -pub struct TorrentMaps { +struct TorrentMaps { pub ipv4: TorrentMap, pub ipv6: TorrentMap, } impl TorrentMaps { - pub fn clean(&mut self, config: &Config, access_list: &Arc) { + fn clean(&mut self, config: &Config, access_list: &Arc) { let mut access_list_cache = create_access_list_cache(access_list); Self::clean_torrent_map(config, &mut access_list_cache, &mut self.ipv4); @@ -236,7 +236,7 @@ async fn handle_request_stream( .await; } -pub fn handle_announce_request( +fn handle_announce_request( config: &Config, rng: &mut SmallRng, torrent_maps: &mut TorrentMaps, @@ -374,7 +374,7 @@ pub fn handle_announce_request( out_messages.push((request_sender_meta, out_message)); } -pub fn handle_scrape_request( +fn handle_scrape_request( config: &Config, torrent_maps: &mut TorrentMaps, out_messages: &mut Vec<(ConnectionMeta, OutMessage)>,