mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 18:25:30 +00:00
aquatic_http, aquatic_ws: add option for printing statistics
statistics are on number of peers per torrent
This commit is contained in:
parent
23a562c1e5
commit
88423976c4
9 changed files with 150 additions and 1 deletions
|
|
@ -20,6 +20,7 @@ pub struct Config {
|
|||
pub protocol: ProtocolConfig,
|
||||
pub handlers: HandlerConfig,
|
||||
pub cleaning: CleaningConfig,
|
||||
pub statistics: StatisticsConfig,
|
||||
pub privileges: PrivilegeConfig,
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +67,6 @@ pub struct ProtocolConfig {
|
|||
}
|
||||
|
||||
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct HandlerConfig {
|
||||
|
|
@ -89,6 +89,14 @@ pub struct CleaningConfig {
|
|||
}
|
||||
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct StatisticsConfig {
|
||||
/// Print statistics this often (seconds). Don't print when set to zero.
|
||||
pub interval: u64,
|
||||
}
|
||||
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct PrivilegeConfig {
|
||||
|
|
@ -111,6 +119,7 @@ impl Default for Config {
|
|||
protocol: ProtocolConfig::default(),
|
||||
handlers: HandlerConfig::default(),
|
||||
cleaning: CleaningConfig::default(),
|
||||
statistics: StatisticsConfig::default(),
|
||||
privileges: PrivilegeConfig::default(),
|
||||
}
|
||||
}
|
||||
|
|
@ -163,6 +172,15 @@ impl Default for CleaningConfig {
|
|||
}
|
||||
|
||||
|
||||
impl Default for StatisticsConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
interval: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl Default for PrivilegeConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue