@@ -21,7 +21,7 @@ use bittorrent_tracker_core::whitelist;
2121use torrust_tracker_configuration:: Core ;
2222use torrust_tracker_primitives:: core:: AnnounceData ;
2323
24- use crate :: packages :: http_tracker_core ;
24+ use crate :: statistics ;
2525
2626/// The HTTP tracker `announce` service.
2727///
@@ -46,7 +46,7 @@ pub async fn handle_announce(
4646 announce_handler : & Arc < AnnounceHandler > ,
4747 authentication_service : & Arc < AuthenticationService > ,
4848 whitelist_authorization : & Arc < whitelist:: authorization:: WhitelistAuthorization > ,
49- opt_http_stats_event_sender : & Arc < Option < Box < dyn http_tracker_core :: statistics:: event:: sender:: Sender > > > ,
49+ opt_http_stats_event_sender : & Arc < Option < Box < dyn statistics:: event:: sender:: Sender > > > ,
5050 announce_request : & Announce ,
5151 client_ip_sources : & ClientIpSources ,
5252 maybe_key : Option < Key > ,
@@ -95,12 +95,12 @@ pub async fn handle_announce(
9595 match original_peer_ip {
9696 IpAddr :: V4 ( _) => {
9797 http_stats_event_sender
98- . send_event ( http_tracker_core :: statistics:: event:: Event :: Tcp4Announce )
98+ . send_event ( statistics:: event:: Event :: Tcp4Announce )
9999 . await ;
100100 }
101101 IpAddr :: V6 ( _) => {
102102 http_stats_event_sender
103- . send_event ( http_tracker_core :: statistics:: event:: Event :: Tcp6Announce )
103+ . send_event ( statistics:: event:: Event :: Tcp6Announce )
104104 . await ;
105105 }
106106 }
@@ -138,7 +138,7 @@ mod tests {
138138 }
139139
140140 struct CoreHttpTrackerServices {
141- pub http_stats_event_sender : Arc < Option < Box < dyn http_tracker_core :: statistics:: event:: sender:: Sender > > > ,
141+ pub http_stats_event_sender : Arc < Option < Box < dyn statistics:: event:: sender:: Sender > > > ,
142142 }
143143
144144 fn initialize_core_tracker_services ( ) -> ( CoreTrackerServices , CoreHttpTrackerServices ) {
@@ -163,8 +163,7 @@ mod tests {
163163 ) ) ;
164164
165165 // HTTP stats
166- let ( http_stats_event_sender, http_stats_repository) =
167- http_tracker_core:: statistics:: setup:: factory ( config. core . tracker_usage_statistics ) ;
166+ let ( http_stats_event_sender, http_stats_repository) = statistics:: setup:: factory ( config. core . tracker_usage_statistics ) ;
168167 let http_stats_event_sender = Arc :: new ( http_stats_event_sender) ;
169168 let _http_stats_repository = Arc :: new ( http_stats_repository) ;
170169
@@ -229,13 +228,13 @@ mod tests {
229228 use mockall:: mock;
230229 use tokio:: sync:: mpsc:: error:: SendError ;
231230
232- use crate :: packages :: http_tracker_core ;
233- use crate :: servers :: http :: test_helpers :: tests:: sample_info_hash;
231+ use crate :: statistics ;
232+ use crate :: tests:: sample_info_hash;
234233
235234 mock ! {
236235 HttpStatsEventSender { }
237- impl http_tracker_core :: statistics:: event:: sender:: Sender for HttpStatsEventSender {
238- fn send_event( & self , event: http_tracker_core :: statistics:: event:: Event ) -> BoxFuture <' static , Option <Result <( ) , SendError <http_tracker_core :: statistics:: event:: Event > > > > ;
236+ impl statistics:: event:: sender:: Sender for HttpStatsEventSender {
237+ fn send_event( & self , event: statistics:: event:: Event ) -> BoxFuture <' static , Option <Result <( ) , SendError <statistics:: event:: Event > > > > ;
239238 }
240239 }
241240
@@ -252,12 +251,12 @@ mod tests {
252251 use torrust_tracker_test_helpers:: configuration;
253252
254253 use super :: { sample_peer_using_ipv4, sample_peer_using_ipv6} ;
255- use crate :: packages:: http_tracker_core;
256- use crate :: packages:: http_tracker_core:: services:: announce:: handle_announce;
257- use crate :: packages:: http_tracker_core:: services:: announce:: tests:: {
254+ use crate :: services:: announce:: handle_announce;
255+ use crate :: services:: announce:: tests:: {
258256 initialize_core_tracker_services, initialize_core_tracker_services_with_config, sample_announce_request_for_peer,
259257 sample_peer, MockHttpStatsEventSender ,
260258 } ;
259+ use crate :: statistics;
261260
262261 #[ tokio:: test]
263262 async fn it_should_return_the_announce_data ( ) {
@@ -298,10 +297,10 @@ mod tests {
298297 let mut http_stats_event_sender_mock = MockHttpStatsEventSender :: new ( ) ;
299298 http_stats_event_sender_mock
300299 . expect_send_event ( )
301- . with ( eq ( http_tracker_core :: statistics:: event:: Event :: Tcp4Announce ) )
300+ . with ( eq ( statistics:: event:: Event :: Tcp4Announce ) )
302301 . times ( 1 )
303302 . returning ( |_| Box :: pin ( future:: ready ( Some ( Ok ( ( ) ) ) ) ) ) ;
304- let http_stats_event_sender: Arc < Option < Box < dyn http_tracker_core :: statistics:: event:: sender:: Sender > > > =
303+ let http_stats_event_sender: Arc < Option < Box < dyn statistics:: event:: sender:: Sender > > > =
305304 Arc :: new ( Some ( Box :: new ( http_stats_event_sender_mock) ) ) ;
306305
307306 let ( core_tracker_services, mut core_http_tracker_services) = initialize_core_tracker_services ( ) ;
@@ -349,10 +348,10 @@ mod tests {
349348 let mut http_stats_event_sender_mock = MockHttpStatsEventSender :: new ( ) ;
350349 http_stats_event_sender_mock
351350 . expect_send_event ( )
352- . with ( eq ( http_tracker_core :: statistics:: event:: Event :: Tcp4Announce ) )
351+ . with ( eq ( statistics:: event:: Event :: Tcp4Announce ) )
353352 . times ( 1 )
354353 . returning ( |_| Box :: pin ( future:: ready ( Some ( Ok ( ( ) ) ) ) ) ) ;
355- let http_stats_event_sender: Arc < Option < Box < dyn http_tracker_core :: statistics:: event:: sender:: Sender > > > =
354+ let http_stats_event_sender: Arc < Option < Box < dyn statistics:: event:: sender:: Sender > > > =
356355 Arc :: new ( Some ( Box :: new ( http_stats_event_sender_mock) ) ) ;
357356
358357 let ( core_tracker_services, mut core_http_tracker_services) =
@@ -383,10 +382,10 @@ mod tests {
383382 let mut http_stats_event_sender_mock = MockHttpStatsEventSender :: new ( ) ;
384383 http_stats_event_sender_mock
385384 . expect_send_event ( )
386- . with ( eq ( http_tracker_core :: statistics:: event:: Event :: Tcp6Announce ) )
385+ . with ( eq ( statistics:: event:: Event :: Tcp6Announce ) )
387386 . times ( 1 )
388387 . returning ( |_| Box :: pin ( future:: ready ( Some ( Ok ( ( ) ) ) ) ) ) ;
389- let http_stats_event_sender: Arc < Option < Box < dyn http_tracker_core :: statistics:: event:: sender:: Sender > > > =
388+ let http_stats_event_sender: Arc < Option < Box < dyn statistics:: event:: sender:: Sender > > > =
390389 Arc :: new ( Some ( Box :: new ( http_stats_event_sender_mock) ) ) ;
391390
392391 let ( core_tracker_services, mut core_http_tracker_services) = initialize_core_tracker_services ( ) ;
0 commit comments