@@ -9,7 +9,9 @@ use torrust_tracker_configuration::{TrackerPolicy, TORRENT_PEERS_LIMIT};
9
9
use torrust_tracker_primitives:: announce_event:: AnnounceEvent ;
10
10
use torrust_tracker_primitives:: peer:: Peer ;
11
11
use torrust_tracker_primitives:: { peer, NumberOfBytes } ;
12
- use torrust_tracker_torrent_repository:: { EntryMutexStd , EntryMutexTokio , EntryRwLockParkingLot , EntrySingle } ;
12
+ use torrust_tracker_torrent_repository:: {
13
+ EntryMutexParkingLot , EntryMutexStd , EntryMutexTokio , EntryRwLockParkingLot , EntrySingle ,
14
+ } ;
13
15
14
16
use crate :: common:: torrent:: Torrent ;
15
17
use crate :: common:: torrent_peer_builder:: { a_completed_peer, a_started_peer} ;
@@ -29,6 +31,11 @@ fn mutex_tokio() -> Torrent {
29
31
Torrent :: MutexTokio ( EntryMutexTokio :: default ( ) )
30
32
}
31
33
34
+ #[ fixture]
35
+ fn mutex_parking_lot ( ) -> Torrent {
36
+ Torrent :: MutexParkingLot ( EntryMutexParkingLot :: default ( ) )
37
+ }
38
+
32
39
#[ fixture]
33
40
fn rw_lock_parking_lot ( ) -> Torrent {
34
41
Torrent :: RwLockParkingLot ( EntryRwLockParkingLot :: default ( ) )
@@ -104,7 +111,7 @@ async fn make(torrent: &mut Torrent, makes: &Makes) -> Vec<Peer> {
104
111
#[ case:: empty( & Makes :: Empty ) ]
105
112
#[ tokio:: test]
106
113
async fn it_should_be_empty_by_default (
107
- #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
114
+ #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , mutex_parking_lot ( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
108
115
#[ case] makes : & Makes ,
109
116
) {
110
117
make ( & mut torrent, makes) . await ;
@@ -120,7 +127,7 @@ async fn it_should_be_empty_by_default(
120
127
#[ case:: three( & Makes :: Three ) ]
121
128
#[ tokio:: test]
122
129
async fn it_should_check_if_entry_is_good (
123
- #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
130
+ #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , mutex_parking_lot ( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
124
131
#[ case] makes : & Makes ,
125
132
#[ values( policy_none( ) , policy_persist( ) , policy_remove( ) , policy_remove_persist( ) ) ] policy : TrackerPolicy ,
126
133
) {
@@ -158,7 +165,7 @@ async fn it_should_check_if_entry_is_good(
158
165
#[ case:: three( & Makes :: Three ) ]
159
166
#[ tokio:: test]
160
167
async fn it_should_get_peers_for_torrent_entry (
161
- #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
168
+ #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , mutex_parking_lot ( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
162
169
#[ case] makes : & Makes ,
163
170
) {
164
171
let peers = make ( & mut torrent, makes) . await ;
@@ -217,7 +224,7 @@ async fn it_should_update_a_peer(#[values(single(), mutex_std(), mutex_tokio())]
217
224
#[ case:: three( & Makes :: Three ) ]
218
225
#[ tokio:: test]
219
226
async fn it_should_remove_a_peer_upon_stopped_announcement (
220
- #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
227
+ #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , mutex_parking_lot ( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
221
228
#[ case] makes : & Makes ,
222
229
) {
223
230
use torrust_tracker_primitives:: peer:: ReadInfo as _;
@@ -258,7 +265,7 @@ async fn it_should_remove_a_peer_upon_stopped_announcement(
258
265
#[ case:: three( & Makes :: Three ) ]
259
266
#[ tokio:: test]
260
267
async fn it_should_handle_a_peer_completed_announcement_and_update_the_downloaded_statistic (
261
- #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
268
+ #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , mutex_parking_lot ( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
262
269
#[ case] makes : & Makes ,
263
270
) {
264
271
make ( & mut torrent, makes) . await ;
@@ -289,7 +296,7 @@ async fn it_should_handle_a_peer_completed_announcement_and_update_the_downloade
289
296
#[ case:: three( & Makes :: Three ) ]
290
297
#[ tokio:: test]
291
298
async fn it_should_update_a_peer_as_a_seeder (
292
- #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
299
+ #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , mutex_parking_lot ( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
293
300
#[ case] makes : & Makes ,
294
301
) {
295
302
let peers = make ( & mut torrent, makes) . await ;
@@ -321,7 +328,7 @@ async fn it_should_update_a_peer_as_a_seeder(
321
328
#[ case:: three( & Makes :: Three ) ]
322
329
#[ tokio:: test]
323
330
async fn it_should_update_a_peer_as_incomplete (
324
- #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
331
+ #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , mutex_parking_lot ( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
325
332
#[ case] makes : & Makes ,
326
333
) {
327
334
let peers = make ( & mut torrent, makes) . await ;
@@ -353,7 +360,7 @@ async fn it_should_update_a_peer_as_incomplete(
353
360
#[ case:: three( & Makes :: Three ) ]
354
361
#[ tokio:: test]
355
362
async fn it_should_get_peers_excluding_the_client_socket (
356
- #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
363
+ #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , mutex_parking_lot ( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
357
364
#[ case] makes : & Makes ,
358
365
) {
359
366
make ( & mut torrent, makes) . await ;
@@ -385,7 +392,7 @@ async fn it_should_get_peers_excluding_the_client_socket(
385
392
#[ case:: three( & Makes :: Three ) ]
386
393
#[ tokio:: test]
387
394
async fn it_should_limit_the_number_of_peers_returned (
388
- #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
395
+ #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , mutex_parking_lot ( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
389
396
#[ case] makes : & Makes ,
390
397
) {
391
398
make ( & mut torrent, makes) . await ;
@@ -410,7 +417,7 @@ async fn it_should_limit_the_number_of_peers_returned(
410
417
#[ case:: three( & Makes :: Three ) ]
411
418
#[ tokio:: test]
412
419
async fn it_should_remove_inactive_peers_beyond_cutoff (
413
- #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
420
+ #[ values( single( ) , mutex_std( ) , mutex_tokio( ) , mutex_parking_lot ( ) , rw_lock_parking_lot( ) ) ] mut torrent : Torrent ,
414
421
#[ case] makes : & Makes ,
415
422
) {
416
423
const TIMEOUT : Duration = Duration :: from_secs ( 120 ) ;
0 commit comments