mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
udp: config: rename channel_recv_timeout_ms and move to root, add docs
This commit is contained in:
parent
2fe57b9f67
commit
125d3c49d6
2 changed files with 8 additions and 17 deletions
|
|
@ -20,9 +20,14 @@ pub struct Config {
|
|||
/// between workers. A value of zero means that the channel will be of
|
||||
/// unbounded size.
|
||||
pub worker_channel_size: usize,
|
||||
/// How long to block waiting for requests in request workers. Higher
|
||||
/// values means that with zero traffic, the worker will not unnecessarily
|
||||
/// cause the CPU to wake up as often. However, high values (something like
|
||||
/// larger than 1000) combined with very low traffic can cause delays
|
||||
/// in torrent cleaning.
|
||||
pub request_channel_recv_timeout_ms: u64,
|
||||
pub network: NetworkConfig,
|
||||
pub protocol: ProtocolConfig,
|
||||
pub handlers: HandlerConfig,
|
||||
pub statistics: StatisticsConfig,
|
||||
pub cleaning: CleaningConfig,
|
||||
pub privileges: PrivilegeConfig,
|
||||
|
|
@ -38,9 +43,9 @@ impl Default for Config {
|
|||
request_workers: 1,
|
||||
log_level: LogLevel::Error,
|
||||
worker_channel_size: 0,
|
||||
request_channel_recv_timeout_ms: 100,
|
||||
network: NetworkConfig::default(),
|
||||
protocol: ProtocolConfig::default(),
|
||||
handlers: HandlerConfig::default(),
|
||||
statistics: StatisticsConfig::default(),
|
||||
cleaning: CleaningConfig::default(),
|
||||
privileges: PrivilegeConfig::default(),
|
||||
|
|
@ -115,20 +120,6 @@ impl Default for ProtocolConfig {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct HandlerConfig {
|
||||
pub channel_recv_timeout_ms: u64,
|
||||
}
|
||||
|
||||
impl Default for HandlerConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
channel_recv_timeout_ms: 100,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct StatisticsConfig {
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ pub fn run_request_worker(
|
|||
let mut torrents = TorrentMaps::default();
|
||||
let mut small_rng = SmallRng::from_entropy();
|
||||
|
||||
let timeout = Duration::from_millis(config.handlers.channel_recv_timeout_ms);
|
||||
let timeout = Duration::from_millis(config.request_channel_recv_timeout_ms);
|
||||
let mut peer_valid_until = ValidUntil::new(config.cleaning.max_peer_age);
|
||||
|
||||
let cleaning_interval = Duration::from_secs(config.cleaning.torrent_cleaning_interval);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue