@@ -453,7 +453,6 @@ use std::net::IpAddr;
453
453
use std:: sync:: Arc ;
454
454
455
455
use bittorrent_primitives:: info_hash:: InfoHash ;
456
- use torrent:: manager:: TorrentsManager ;
457
456
use torrent:: repository:: in_memory:: InMemoryTorrentRepository ;
458
457
use torrent:: repository:: persisted:: DatabasePersistentTorrentRepository ;
459
458
use torrust_tracker_configuration:: { AnnouncePolicy , Core , TORRENT_PEERS_LIMIT } ;
@@ -483,9 +482,6 @@ pub struct Tracker {
483
482
484
483
/// The persistent torrents repository.
485
484
db_torrent_repository : Arc < DatabasePersistentTorrentRepository > ,
486
-
487
- /// The service to run torrents tasks.
488
- torrents_manager : Arc < TorrentsManager > ,
489
485
}
490
486
491
487
/// How many peers the peer announcing wants in the announce response.
@@ -541,14 +537,12 @@ impl Tracker {
541
537
whitelist_authorization : & Arc < whitelist:: authorization:: Authorization > ,
542
538
in_memory_torrent_repository : & Arc < InMemoryTorrentRepository > ,
543
539
db_torrent_repository : & Arc < DatabasePersistentTorrentRepository > ,
544
- torrents_manager : & Arc < TorrentsManager > ,
545
540
) -> Result < Tracker , databases:: error:: Error > {
546
541
Ok ( Tracker {
547
542
config : config. clone ( ) ,
548
543
whitelist_authorization : whitelist_authorization. clone ( ) ,
549
544
in_memory_torrent_repository : in_memory_torrent_repository. clone ( ) ,
550
545
db_torrent_repository : db_torrent_repository. clone ( ) ,
551
- torrents_manager : torrents_manager. clone ( ) ,
552
546
} )
553
547
}
554
548
@@ -724,13 +718,6 @@ impl Tracker {
724
718
pub fn get_torrents_metrics ( & self ) -> TorrentsMetrics {
725
719
self . in_memory_torrent_repository . get_torrents_metrics ( )
726
720
}
727
-
728
- /// Remove inactive peers and (optionally) peerless torrents.
729
- ///
730
- /// # Context: Tracker
731
- pub fn cleanup_torrents ( & self ) {
732
- self . torrents_manager . cleanup_torrents ( ) ;
733
- }
734
721
}
735
722
736
723
#[ must_use]
@@ -761,6 +748,7 @@ mod tests {
761
748
use crate :: app_test:: initialize_tracker_dependencies;
762
749
use crate :: core:: peer:: Peer ;
763
750
use crate :: core:: services:: { initialize_tracker, initialize_whitelist_manager} ;
751
+ use crate :: core:: torrent:: manager:: TorrentsManager ;
764
752
use crate :: core:: whitelist:: manager:: WhiteListManager ;
765
753
use crate :: core:: { whitelist, TorrentsMetrics , Tracker } ;
766
754
@@ -774,15 +762,14 @@ mod tests {
774
762
_authentication_service,
775
763
in_memory_torrent_repository,
776
764
db_torrent_repository,
777
- torrents_manager ,
765
+ _torrents_manager ,
778
766
) = initialize_tracker_dependencies ( & config) ;
779
767
780
768
initialize_tracker (
781
769
& config,
782
770
& whitelist_authorization,
783
771
& in_memory_torrent_repository,
784
772
& db_torrent_repository,
785
- & torrents_manager,
786
773
)
787
774
}
788
775
@@ -796,7 +783,7 @@ mod tests {
796
783
_authentication_service,
797
784
in_memory_torrent_repository,
798
785
db_torrent_repository,
799
- torrents_manager ,
786
+ _torrents_manager ,
800
787
) = initialize_tracker_dependencies ( & config) ;
801
788
802
789
let whitelist_manager = initialize_whitelist_manager ( database. clone ( ) , in_memory_whitelist. clone ( ) ) ;
@@ -806,13 +793,12 @@ mod tests {
806
793
& whitelist_authorization,
807
794
& in_memory_torrent_repository,
808
795
& db_torrent_repository,
809
- & torrents_manager,
810
796
) ;
811
797
812
798
( tracker, whitelist_authorization, whitelist_manager)
813
799
}
814
800
815
- pub fn tracker_persisting_torrents_in_database ( ) -> Tracker {
801
+ pub fn tracker_persisting_torrents_in_database ( ) -> ( Tracker , Arc < TorrentsManager > ) {
816
802
let mut config = configuration:: ephemeral_listed ( ) ;
817
803
config. core . tracker_policy . persistent_torrent_completed_stat = true ;
818
804
@@ -826,13 +812,14 @@ mod tests {
826
812
torrents_manager,
827
813
) = initialize_tracker_dependencies ( & config) ;
828
814
829
- initialize_tracker (
815
+ let tracker = initialize_tracker (
830
816
& config,
831
817
& whitelist_authorization,
832
818
& in_memory_torrent_repository,
833
819
& db_torrent_repository,
834
- & torrents_manager,
835
- )
820
+ ) ;
821
+
822
+ ( tracker, torrents_manager)
836
823
}
837
824
838
825
fn sample_info_hash ( ) -> InfoHash {
@@ -1492,7 +1479,7 @@ mod tests {
1492
1479
1493
1480
#[ tokio:: test]
1494
1481
async fn it_should_persist_the_number_of_completed_peers_for_all_torrents_into_the_database ( ) {
1495
- let tracker = tracker_persisting_torrents_in_database ( ) ;
1482
+ let ( tracker, torrents_manager ) = tracker_persisting_torrents_in_database ( ) ;
1496
1483
1497
1484
let info_hash = sample_info_hash ( ) ;
1498
1485
@@ -1509,7 +1496,7 @@ mod tests {
1509
1496
// Remove the newly updated torrent from memory
1510
1497
let _unused = tracker. in_memory_torrent_repository . remove ( & info_hash) ;
1511
1498
1512
- tracker . torrents_manager . load_torrents_from_database ( ) . unwrap ( ) ;
1499
+ torrents_manager. load_torrents_from_database ( ) . unwrap ( ) ;
1513
1500
1514
1501
let torrent_entry = tracker
1515
1502
. in_memory_torrent_repository
0 commit comments