@@ -271,23 +271,17 @@ mod tests {
271271
272272 fn initialized_public_tracker ( ) -> Arc < TorrentTracker > {
273273 let configuration = Arc :: new ( TrackerConfigurationBuilder :: default ( ) . with_mode ( TrackerMode :: Public ) . into ( ) ) ;
274- Arc :: new ( TorrentTracker :: new ( configuration, Box :: new ( initialized_stats_tracker ( ) ) ) . unwrap ( ) )
274+ Arc :: new ( TorrentTracker :: new ( configuration, Box :: new ( StatsTracker :: new_active_instance ( ) ) ) . unwrap ( ) )
275275 }
276276
277277 fn initialized_private_tracker ( ) -> Arc < TorrentTracker > {
278278 let configuration = Arc :: new ( TrackerConfigurationBuilder :: default ( ) . with_mode ( TrackerMode :: Private ) . into ( ) ) ;
279- Arc :: new ( TorrentTracker :: new ( configuration, Box :: new ( initialized_stats_tracker ( ) ) ) . unwrap ( ) )
279+ Arc :: new ( TorrentTracker :: new ( configuration, Box :: new ( StatsTracker :: new_active_instance ( ) ) ) . unwrap ( ) )
280280 }
281281
282282 fn initialized_whitelisted_tracker ( ) -> Arc < TorrentTracker > {
283283 let configuration = Arc :: new ( TrackerConfigurationBuilder :: default ( ) . with_mode ( TrackerMode :: Listed ) . into ( ) ) ;
284- Arc :: new ( TorrentTracker :: new ( configuration, Box :: new ( initialized_stats_tracker ( ) ) ) . unwrap ( ) )
285- }
286-
287- fn initialized_stats_tracker ( ) -> StatsTracker {
288- let mut stats_tracker = StatsTracker :: new ( ) ;
289- stats_tracker. run_worker ( ) ;
290- stats_tracker
284+ Arc :: new ( TorrentTracker :: new ( configuration, Box :: new ( StatsTracker :: new_active_instance ( ) ) ) . unwrap ( ) )
291285 }
292286
293287 fn sample_ipv4_remote_addr ( ) -> SocketAddr {
@@ -965,16 +959,18 @@ mod tests {
965959
966960 use aquatic_udp_protocol:: { InfoHash as AquaticInfoHash , PeerId as AquaticPeerId } ;
967961
962+ use crate :: statistics:: StatsTracker ;
968963 use crate :: tracker:: tracker:: TorrentTracker ;
969964 use crate :: udp:: connection_cookie:: { into_connection_id, make_connection_cookie} ;
970965 use crate :: udp:: handle_announce;
971966 use crate :: udp:: handlers:: tests:: announce_request:: AnnounceRequestBuilder ;
972- use crate :: udp:: handlers:: tests:: { initialized_stats_tracker , TrackerConfigurationBuilder } ;
967+ use crate :: udp:: handlers:: tests:: TrackerConfigurationBuilder ;
973968
974969 #[ tokio:: test]
975970 async fn the_peer_ip_should_be_changed_to_the_external_ip_in_the_tracker_configuration ( ) {
976971 let configuration = Arc :: new ( TrackerConfigurationBuilder :: default ( ) . with_external_ip ( "::126.0.0.1" ) . into ( ) ) ;
977- let tracker = Arc :: new ( TorrentTracker :: new ( configuration, Box :: new ( initialized_stats_tracker ( ) ) ) . unwrap ( ) ) ;
972+ let tracker =
973+ Arc :: new ( TorrentTracker :: new ( configuration, Box :: new ( StatsTracker :: new_active_instance ( ) ) ) . unwrap ( ) ) ;
978974
979975 let loopback_ipv4 = Ipv4Addr :: new ( 127 , 0 , 0 , 1 ) ;
980976 let loopback_ipv6 = Ipv6Addr :: new ( 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 ) ;
0 commit comments