mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 09:45:31 +00:00
add missed condition to collect an additional data, implement as shared config function
This commit is contained in:
parent
3fa126ffa5
commit
e238db4439
2 changed files with 5 additions and 1 deletions
|
|
@ -225,6 +225,10 @@ impl StatisticsConfig {
|
|||
}
|
||||
}
|
||||
}
|
||||
/// Skip info-hash collection if not required by the configuration
|
||||
pub fn collect_info_hash(&self) -> bool {
|
||||
(self.interval != 0) & (self.write_json_to_file | self.write_bin_to_file)
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for StatisticsConfig {
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ impl<I: Ip> TorrentMapShards<I> {
|
|||
|
||||
total_num_torrents += torrent_map_shard.len();
|
||||
|
||||
if config.statistics.write_json_to_file {
|
||||
if config.statistics.collect_info_hash() {
|
||||
info_hashes.reserve(total_num_torrents);
|
||||
for (k, _) in torrent_map_shard.iter() {
|
||||
info_hashes.push(*k)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue