20
20
21
21
use crate :: config:: { Config , QuinnConfig } ;
22
22
use crate :: provider:: Provider ;
23
- use crate :: { Connecting , ConnectError , Connection , Error } ;
23
+ use crate :: { ConnectError , Connecting , Connection , Error } ;
24
24
25
25
use futures:: future:: BoxFuture ;
26
26
use futures:: ready;
@@ -89,7 +89,11 @@ impl<P: Provider> GenTransport<P> {
89
89
}
90
90
}
91
91
/// Create a new [`quinn::Endpoint`] with the given configs.
92
- fn new_endpoint ( endpoint_config : quinn:: EndpointConfig , server_config : Option < quinn:: ServerConfig > , socket_addr : SocketAddr ) -> Result < quinn:: Endpoint , Error > {
92
+ fn new_endpoint (
93
+ endpoint_config : quinn:: EndpointConfig ,
94
+ server_config : Option < quinn:: ServerConfig > ,
95
+ socket_addr : SocketAddr ,
96
+ ) -> Result < quinn:: Endpoint , Error > {
93
97
let socket = UdpSocket :: bind ( socket_addr) ?;
94
98
let endpoint = quinn:: Endpoint :: new ( endpoint_config, server_config, socket, P :: runtime ( ) ) ?;
95
99
Ok ( endpoint)
@@ -185,7 +189,8 @@ impl<P: Provider> Transport for GenTransport<P> {
185
189
SocketFamily :: Ipv6 => SocketAddr :: new ( Ipv6Addr :: UNSPECIFIED . into ( ) , 0 ) ,
186
190
} ;
187
191
let endpoint_config = self . quinn_config . endpoint_config . clone ( ) ;
188
- let endpoint = Self :: new_endpoint ( endpoint_config, None , listen_socket_addr) ?;
192
+ let endpoint =
193
+ Self :: new_endpoint ( endpoint_config, None , listen_socket_addr) ?;
189
194
190
195
vacant. insert ( endpoint. clone ( ) ) ;
191
196
endpoint
@@ -211,7 +216,8 @@ impl<P: Provider> Transport for GenTransport<P> {
211
216
// This `"l"` seems necessary because an empty string is an invalid domain
212
217
// name. While we don't use domain names, the underlying rustls library
213
218
// is based upon the assumption that we do.
214
- let connecting = endpoint. connect_with ( client_config, socket_addr, "l" )
219
+ let connecting = endpoint
220
+ . connect_with ( client_config, socket_addr, "l" )
215
221
. map_err ( ConnectError ) ?;
216
222
Connecting :: new ( connecting, handshake_timeout) . await
217
223
} ) )
@@ -349,11 +355,9 @@ impl<P: Provider> Listener<P> {
349
355
loop {
350
356
match ready ! ( P :: poll_if_event( if_watcher, cx) ) {
351
357
Ok ( IfEvent :: Up ( inet) ) => {
352
- if let Some ( listen_addr) = ip_to_listenaddr (
353
- & endpoint_addr,
354
- inet. addr ( ) ,
355
- self . version ,
356
- ) {
358
+ if let Some ( listen_addr) =
359
+ ip_to_listenaddr ( & endpoint_addr, inet. addr ( ) , self . version )
360
+ {
357
361
log:: debug!( "New listen address: {}" , listen_addr) ;
358
362
return Poll :: Ready ( TransportEvent :: NewAddress {
359
363
listener_id : self . listener_id ,
@@ -362,11 +366,9 @@ impl<P: Provider> Listener<P> {
362
366
}
363
367
}
364
368
Ok ( IfEvent :: Down ( inet) ) => {
365
- if let Some ( listen_addr) = ip_to_listenaddr (
366
- & endpoint_addr,
367
- inet. addr ( ) ,
368
- self . version ,
369
- ) {
369
+ if let Some ( listen_addr) =
370
+ ip_to_listenaddr ( & endpoint_addr, inet. addr ( ) , self . version )
371
+ {
370
372
log:: debug!( "Expired listen address: {}" , listen_addr) ;
371
373
return Poll :: Ready ( TransportEvent :: AddressExpired {
372
374
listener_id : self . listener_id ,
0 commit comments