@@ -235,11 +235,11 @@ impl Drop for ActiveRequests {
235
235
}
236
236
237
237
/// Wrapper for Tokio [`UdpSocket`][`tokio::net::UdpSocket`] that is bound to a particular socket.
238
- struct Socket {
238
+ struct BoundSocket {
239
239
socket : Arc < tokio:: net:: UdpSocket > ,
240
240
}
241
241
242
- impl Socket {
242
+ impl BoundSocket {
243
243
async fn new ( addr : SocketAddr ) -> Result < Self , Box < std:: io:: Error > > {
244
244
let socket = tokio:: net:: UdpSocket :: bind ( addr) . await ;
245
245
@@ -257,15 +257,15 @@ impl Socket {
257
257
}
258
258
}
259
259
260
- impl Deref for Socket {
260
+ impl Deref for BoundSocket {
261
261
type Target = tokio:: net:: UdpSocket ;
262
262
263
263
fn deref ( & self ) -> & Self :: Target {
264
264
& self . socket
265
265
}
266
266
}
267
267
268
- impl Debug for Socket {
268
+ impl Debug for BoundSocket {
269
269
fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
270
270
let local_addr = match self . socket . local_addr ( ) {
271
271
Ok ( socket) => format ! ( "Receiving From: {socket}" ) ,
@@ -334,7 +334,7 @@ impl Udp {
334
334
format ! ( "Halting UDP Service Bound to Socket: {bind_to}" ) ,
335
335
) ) ;
336
336
337
- let socket = tokio:: time:: timeout ( Duration :: from_millis ( 5000 ) , Socket :: new ( bind_to) )
337
+ let socket = tokio:: time:: timeout ( Duration :: from_millis ( 5000 ) , BoundSocket :: new ( bind_to) )
338
338
. await
339
339
. expect ( "it should bind to the socket within five seconds" ) ;
340
340
@@ -543,17 +543,14 @@ impl Udp {
543
543
544
544
#[ cfg( test) ]
545
545
mod tests {
546
- use std:: { sync:: Arc , time:: Duration } ;
546
+ use std:: sync:: Arc ;
547
+ use std:: time:: Duration ;
547
548
548
549
use torrust_tracker_test_helpers:: configuration:: ephemeral_mode_public;
549
550
550
- use crate :: {
551
- bootstrap:: app:: initialize_with_configuration,
552
- servers:: {
553
- registar:: Registar ,
554
- udp:: server:: { Launcher , UdpServer } ,
555
- } ,
556
- } ;
551
+ use crate :: bootstrap:: app:: initialize_with_configuration;
552
+ use crate :: servers:: registar:: Registar ;
553
+ use crate :: servers:: udp:: server:: { Launcher , UdpServer } ;
557
554
558
555
#[ tokio:: test]
559
556
async fn it_should_be_able_to_start_and_stop ( ) {
0 commit comments