@@ -120,7 +120,7 @@ async fn config_ephemeral_peers_inner(
120
120
// NOTE: This one often fails with multihop on Windows, even though the handshake afterwards
121
121
// succeeds. So we try anyway if it fails.
122
122
#[ cfg( force_wireguard_handshake) ]
123
- let _ = establish_tunnel_connection ( tunnel, connectivity) . await ;
123
+ let _ = establish_tunnel_connection ( tunnel, connectivity) ;
124
124
125
125
let ephemeral_private_key = PrivateKey :: new_from_random ( ) ;
126
126
let close_obfs_sender = close_obfs_sender. clone ( ) ;
@@ -158,7 +158,7 @@ async fn config_ephemeral_peers_inner(
158
158
. await ?;
159
159
160
160
#[ cfg( force_wireguard_handshake) ]
161
- establish_tunnel_connection ( tunnel, connectivity) . await ?;
161
+ establish_tunnel_connection ( tunnel, connectivity) ?;
162
162
163
163
let entry_psk = request_ephemeral_peer (
164
164
retry_attempt,
@@ -279,16 +279,17 @@ async fn reconfigure_tunnel(
279
279
/// Ensure that the WireGuard tunnel works. This is useful after updating the WireGuard config, to
280
280
/// force a WireGuard handshake. This should reduce the number of PQ timeouts.
281
281
#[ cfg( force_wireguard_handshake) ]
282
- async fn establish_tunnel_connection (
282
+ fn establish_tunnel_connection (
283
283
tunnel : & Arc < AsyncMutex < Option < TunnelType > > > ,
284
284
connectivity : & mut connectivity:: Check < connectivity:: Cancellable > ,
285
285
) -> Result < ( ) , CloseMsg > {
286
286
use talpid_types:: ErrorExt ;
287
287
288
- let shared_tunnel = tunnel. lock ( ) . await ;
289
- let tunnel = shared_tunnel. as_ref ( ) . expect ( "tunnel was None" ) ;
290
- let ping_result = connectivity. establish_connectivity ( tunnel) ;
291
- drop ( shared_tunnel) ;
288
+ let ping_result = tokio:: task:: block_in_place ( || {
289
+ let shared_tunnel = tunnel. blocking_lock ( ) ;
290
+ let tunnel = shared_tunnel. as_ref ( ) . expect ( "tunnel was None" ) ;
291
+ connectivity. establish_connectivity ( tunnel)
292
+ } ) ;
292
293
293
294
match ping_result {
294
295
Ok ( true ) => Ok ( ( ) ) ,
0 commit comments