14
14
//! "leader" side and one "follower" side (formerly called "sender" and "receiver").
15
15
16
16
#[ allow( deprecated) ]
17
- use crate :: { util , Key , KeyPurpose } ;
17
+ use crate :: { Key , KeyPurpose } ;
18
18
use serde_derive:: { Deserialize , Serialize } ;
19
19
20
20
#[ cfg( not( target_family = "wasm" ) ) ]
@@ -797,7 +797,7 @@ pub async fn init(
797
797
* so that we will be NATted to the same port again. If it doesn't, simply bind a new socket
798
798
* and use that instead.
799
799
*/
800
- let socket: MaybeConnectedSocket = match util :: timeout (
800
+ let socket: MaybeConnectedSocket = match async_std :: future :: timeout (
801
801
std:: time:: Duration :: from_secs ( 4 ) ,
802
802
transport:: tcp_get_external_ip ( ) ,
803
803
)
@@ -1008,14 +1008,16 @@ impl TransitConnector {
1008
1008
} ) ,
1009
1009
) ;
1010
1010
1011
- let ( mut transit, mut finalizer, mut conn_info) =
1012
- util:: timeout ( std:: time:: Duration :: from_secs ( 60 ) , connection_stream. next ( ) )
1013
- . await
1014
- . map_err ( |_| {
1015
- tracing:: debug!( "`leader_connect` timed out" ) ;
1016
- TransitConnectError :: Handshake
1017
- } ) ?
1018
- . ok_or ( TransitConnectError :: Handshake ) ?;
1011
+ let ( mut transit, mut finalizer, mut conn_info) = async_std:: future:: timeout (
1012
+ std:: time:: Duration :: from_secs ( 60 ) ,
1013
+ connection_stream. next ( ) ,
1014
+ )
1015
+ . await
1016
+ . map_err ( |_| {
1017
+ tracing:: debug!( "`leader_connect` timed out" ) ;
1018
+ TransitConnectError :: Handshake
1019
+ } ) ?
1020
+ . ok_or ( TransitConnectError :: Handshake ) ?;
1019
1021
1020
1022
if conn_info. conn_type != ConnectionType :: Direct && our_abilities. can_direct ( ) {
1021
1023
tracing:: debug!(
@@ -1031,7 +1033,7 @@ impl TransitConnector {
1031
1033
} else {
1032
1034
elapsed. mul_f32 ( 0.3 )
1033
1035
} ;
1034
- let _ = util :: timeout ( to_wait, async {
1036
+ let _ = async_std :: future :: timeout ( to_wait, async {
1035
1037
while let Some ( ( new_transit, new_finalizer, new_conn_info) ) =
1036
1038
connection_stream. next ( ) . await
1037
1039
{
@@ -1113,7 +1115,7 @@ impl TransitConnector {
1113
1115
} ) ,
1114
1116
) ;
1115
1117
1116
- let transit = match util :: timeout (
1118
+ let transit = match async_std :: future :: timeout (
1117
1119
std:: time:: Duration :: from_secs ( 60 ) ,
1118
1120
& mut connection_stream. next ( ) ,
1119
1121
)
@@ -1260,7 +1262,7 @@ impl TransitConnector {
1260
1262
. map ( move |( i, h) | ( i, h, name. clone ( ) ) )
1261
1263
} )
1262
1264
. map ( |( index, host, name) | async move {
1263
- util :: sleep ( std:: time:: Duration :: from_secs (
1265
+ async_std :: task :: sleep ( std:: time:: Duration :: from_secs (
1264
1266
index as u64 * 5 ,
1265
1267
) )
1266
1268
. await ;
@@ -1304,7 +1306,7 @@ impl TransitConnector {
1304
1306
. map ( move |( i, u) | ( i, u, name. clone ( ) ) )
1305
1307
} )
1306
1308
. map ( |( index, url, name) | async move {
1307
- util :: sleep ( std:: time:: Duration :: from_secs (
1309
+ async_std :: task :: sleep ( std:: time:: Duration :: from_secs (
1308
1310
index as u64 * 5 ,
1309
1311
) )
1310
1312
. await ;
0 commit comments