@@ -3,7 +3,7 @@ use torrust_tracker_primitives::TrackerMode;
3
3
4
4
use super :: network:: Network ;
5
5
use crate :: v1:: database:: Database ;
6
- use crate :: AnnouncePolicy ;
6
+ use crate :: { AnnouncePolicy , TrackerPolicy } ;
7
7
8
8
#[ allow( clippy:: struct_excessive_bools) ]
9
9
#[ derive( Serialize , Deserialize , PartialEq , Eq , Debug , Clone ) ]
@@ -20,30 +20,14 @@ pub struct Core {
20
20
#[ serde( default = "Core::default_tracker_usage_statistics" ) ]
21
21
pub tracker_usage_statistics : bool ,
22
22
23
- /// If enabled the tracker will persist the number of completed downloads.
24
- /// That's how many times a torrent has been downloaded completely.
25
- #[ serde( default = "Core::default_persistent_torrent_completed_stat" ) ]
26
- pub persistent_torrent_completed_stat : bool ,
27
-
28
- // Cleanup job configuration
29
- /// Maximum time in seconds that a peer can be inactive before being
30
- /// considered an inactive peer. If a peer is inactive for more than this
31
- /// time, it will be removed from the torrent peer list.
32
- #[ serde( default = "Core::default_max_peer_timeout" ) ]
33
- pub max_peer_timeout : u32 ,
34
-
35
23
/// Interval in seconds that the cleanup job will run to remove inactive
36
24
/// peers from the torrent peer list.
37
25
#[ serde( default = "Core::default_inactive_peer_cleanup_interval" ) ]
38
26
pub inactive_peer_cleanup_interval : u64 ,
39
27
40
- /// If enabled, the tracker will remove torrents that have no peers.
41
- /// The clean up torrent job runs every `inactive_peer_cleanup_interval`
42
- /// seconds and it removes inactive peers. Eventually, the peer list of a
43
- /// torrent could be empty and the torrent will be removed if this option is
44
- /// enabled.
45
- #[ serde( default = "Core::default_remove_peerless_torrents" ) ]
46
- pub remove_peerless_torrents : bool ,
28
+ // Tracker policy configuration.
29
+ #[ serde( default = "Core::default_tracker_policy" ) ]
30
+ pub tracker_policy : TrackerPolicy ,
47
31
48
32
// Announce policy configuration.
49
33
#[ serde( default = "Core::default_announce_policy" ) ]
@@ -62,11 +46,9 @@ impl Default for Core {
62
46
fn default ( ) -> Self {
63
47
Self {
64
48
mode : Self :: default_mode ( ) ,
65
- max_peer_timeout : Self :: default_max_peer_timeout ( ) ,
66
49
tracker_usage_statistics : Self :: default_tracker_usage_statistics ( ) ,
67
- persistent_torrent_completed_stat : Self :: default_persistent_torrent_completed_stat ( ) ,
68
50
inactive_peer_cleanup_interval : Self :: default_inactive_peer_cleanup_interval ( ) ,
69
- remove_peerless_torrents : Self :: default_remove_peerless_torrents ( ) ,
51
+ tracker_policy : Self :: default_tracker_policy ( ) ,
70
52
announce_policy : Self :: default_announce_policy ( ) ,
71
53
database : Self :: default_database ( ) ,
72
54
net : Self :: default_network ( ) ,
@@ -83,20 +65,12 @@ impl Core {
83
65
true
84
66
}
85
67
86
- fn default_persistent_torrent_completed_stat ( ) -> bool {
87
- false
88
- }
89
-
90
- fn default_max_peer_timeout ( ) -> u32 {
91
- 900
92
- }
93
-
94
68
fn default_inactive_peer_cleanup_interval ( ) -> u64 {
95
69
600
96
70
}
97
71
98
- fn default_remove_peerless_torrents ( ) -> bool {
99
- true
72
+ fn default_tracker_policy ( ) -> TrackerPolicy {
73
+ TrackerPolicy :: default ( )
100
74
}
101
75
102
76
fn default_announce_policy ( ) -> AnnouncePolicy {
0 commit comments