@@ -4,6 +4,7 @@ use std::sync::Arc;
4
4
5
5
use axum_server:: tls_rustls:: RustlsConfig ;
6
6
use axum_server:: Handle ;
7
+ use bittorrent_http_tracker_core:: container:: HttpTrackerCoreContainer ;
7
8
use derive_more:: Constructor ;
8
9
use futures:: future:: BoxFuture ;
9
10
use tokio:: sync:: oneshot:: { Receiver , Sender } ;
@@ -15,7 +16,6 @@ use torrust_server_lib::signals::{Halted, Started};
15
16
use tracing:: instrument;
16
17
17
18
use super :: v1:: routes:: router;
18
- use crate :: container:: HttpTrackerContainer ;
19
19
use crate :: HTTP_TRACKER_LOG_TARGET ;
20
20
21
21
/// Error that can occur when starting or stopping the HTTP server.
@@ -45,7 +45,7 @@ impl Launcher {
45
45
#[ instrument( skip( self , http_tracker_container, tx_start, rx_halt) ) ]
46
46
fn start (
47
47
& self ,
48
- http_tracker_container : Arc < HttpTrackerContainer > ,
48
+ http_tracker_container : Arc < HttpTrackerCoreContainer > ,
49
49
tx_start : Sender < Started > ,
50
50
rx_halt : Receiver < Halted > ,
51
51
) -> BoxFuture < ' static , ( ) > {
@@ -160,7 +160,7 @@ impl HttpServer<Stopped> {
160
160
/// back to the main thread.
161
161
pub async fn start (
162
162
self ,
163
- http_tracker_container : Arc < HttpTrackerContainer > ,
163
+ http_tracker_container : Arc < HttpTrackerCoreContainer > ,
164
164
form : ServiceRegistrationForm ,
165
165
) -> Result < HttpServer < Running > , Error > {
166
166
let ( tx_start, rx_start) = tokio:: sync:: oneshot:: channel :: < Started > ( ) ;
@@ -238,6 +238,7 @@ pub fn check_fn(binding: &SocketAddr) -> ServiceHealthCheckJob {
238
238
mod tests {
239
239
use std:: sync:: Arc ;
240
240
241
+ use bittorrent_http_tracker_core:: container:: HttpTrackerCoreContainer ;
241
242
use bittorrent_tracker_core:: announce_handler:: AnnounceHandler ;
242
243
use bittorrent_tracker_core:: authentication:: key:: repository:: in_memory:: InMemoryKeyRepository ;
243
244
use bittorrent_tracker_core:: authentication:: service;
@@ -252,10 +253,9 @@ mod tests {
252
253
use torrust_tracker_configuration:: Configuration ;
253
254
use torrust_tracker_test_helpers:: configuration:: ephemeral_public;
254
255
255
- use crate :: container:: HttpTrackerContainer ;
256
256
use crate :: server:: { HttpServer , Launcher } ;
257
257
258
- pub fn initialize_container ( configuration : & Configuration ) -> HttpTrackerContainer {
258
+ pub fn initialize_container ( configuration : & Configuration ) -> HttpTrackerCoreContainer {
259
259
let core_config = Arc :: new ( configuration. core . clone ( ) ) ;
260
260
261
261
let http_trackers = configuration
@@ -268,9 +268,10 @@ mod tests {
268
268
let http_tracker_config = Arc :: new ( http_tracker_config. clone ( ) ) ;
269
269
270
270
// HTTP stats
271
- let ( http_stats_event_sender, _http_stats_repository ) =
271
+ let ( http_stats_event_sender, http_stats_repository ) =
272
272
bittorrent_http_tracker_core:: statistics:: setup:: factory ( configuration. core . tracker_usage_statistics ) ;
273
273
let http_stats_event_sender = Arc :: new ( http_stats_event_sender) ;
274
+ let http_stats_repository = Arc :: new ( http_stats_repository) ;
274
275
275
276
let database = initialize_database ( & configuration. core ) ;
276
277
let in_memory_whitelist = Arc :: new ( InMemoryWhitelist :: default ( ) ) ;
@@ -292,14 +293,16 @@ mod tests {
292
293
293
294
let scrape_handler = Arc :: new ( ScrapeHandler :: new ( & whitelist_authorization, & in_memory_torrent_repository) ) ;
294
295
295
- HttpTrackerContainer {
296
+ HttpTrackerCoreContainer {
296
297
core_config,
297
- http_tracker_config,
298
298
announce_handler,
299
299
scrape_handler,
300
300
whitelist_authorization,
301
- http_stats_event_sender,
302
301
authentication_service,
302
+
303
+ http_tracker_config,
304
+ http_stats_event_sender,
305
+ http_stats_repository,
303
306
}
304
307
}
305
308
0 commit comments