aquatic: add comments to many config fields

This commit is contained in:
Joakim Frostegård 2020-04-08 21:50:23 +02:00
parent e3b29723a4
commit 58fbf8b7fe

View file

@ -3,6 +3,7 @@ use std::net::SocketAddr;
#[derive(Clone)] #[derive(Clone)]
pub struct Config { pub struct Config {
/// Spawn this number of threads for workers
pub num_threads: usize, pub num_threads: usize,
pub network: NetworkConfig, pub network: NetworkConfig,
pub statistics: StatisticsConfig, pub statistics: StatisticsConfig,
@ -12,11 +13,15 @@ pub struct Config {
#[derive(Clone)] #[derive(Clone)]
pub struct NetworkConfig { pub struct NetworkConfig {
/// Bind to this address
pub address: SocketAddr, pub address: SocketAddr,
/// Maximum number of torrents to accept in scrape request
pub max_scrape_torrents: u8, pub max_scrape_torrents: u8,
/// Maximum number of peers to return in announce response
pub max_response_peers: usize, pub max_response_peers: usize,
/// Ask peers to announce this often (seconds)
pub peer_announce_interval: i32, pub peer_announce_interval: i32,
/// When value is zero, use OS default (don't set on socket) /// Setting on socket. When value is zero, don't set (use OS default)
pub recv_buffer_size: usize, pub recv_buffer_size: usize,
pub poll_event_capacity: usize, pub poll_event_capacity: usize,
} }
@ -24,14 +29,18 @@ pub struct NetworkConfig {
#[derive(Clone)] #[derive(Clone)]
pub struct StatisticsConfig { pub struct StatisticsConfig {
/// Print statistics this often (seconds). Don't print when set to zero.
pub interval: u64, pub interval: u64,
} }
#[derive(Clone)] #[derive(Clone)]
pub struct CleaningConfig { pub struct CleaningConfig {
/// Clean torrents and connections this often (seconds)
pub interval: u64, pub interval: u64,
/// Remove peers that haven't announced for this long (seconds)
pub max_peer_age: u64, pub max_peer_age: u64,
/// Remove connections that are older than this (seconds)
pub max_connection_age: u64, pub max_connection_age: u64,
} }