@@ -717,9 +717,15 @@ where
717
717
. await
718
718
. map_err ( Error :: ApiConnectionModeError ) ?;
719
719
720
- let api_handle = api_runtime
721
- . mullvad_rest_handle ( Box :: pin ( connection_modes_handler. clone ( ) . into_stream ( ) ) )
722
- . await ;
720
+ let initial_connection_mode = connection_modes_handler
721
+ . get_current ( )
722
+ . await
723
+ . map_err ( Error :: ApiConnectionModeError ) ?;
724
+
725
+ let api_handle = api_runtime. mullvad_rest_handle (
726
+ initial_connection_mode. connection_mode ,
727
+ Box :: pin ( connection_modes_handler. clone ( ) . into_stream ( ) ) ,
728
+ ) ;
723
729
724
730
let migration_complete = if let Some ( migration_data) = migration_data {
725
731
migrations:: migrate_device (
@@ -787,11 +793,6 @@ where
787
793
let _ = param_gen_tx. unbounded_send ( settings. tunnel_options . to_owned ( ) ) ;
788
794
} ) ;
789
795
790
- let initial_api_endpoint = connection_modes_handler
791
- . get_current ( )
792
- . await
793
- . map_err ( Error :: ApiConnectionModeError ) ?
794
- . endpoint ;
795
796
let ( offline_state_tx, offline_state_rx) = mpsc:: unbounded ( ) ;
796
797
#[ cfg( target_os = "windows" ) ]
797
798
let ( volume_update_tx, volume_update_rx) = mpsc:: unbounded ( ) ;
@@ -800,7 +801,7 @@ where
800
801
allow_lan : settings. allow_lan ,
801
802
block_when_disconnected : settings. block_when_disconnected ,
802
803
dns_servers : dns:: addresses_from_options ( & settings. tunnel_options . dns_options ) ,
803
- allowed_endpoint : initial_api_endpoint ,
804
+ allowed_endpoint : initial_connection_mode . endpoint ,
804
805
reset_firewall : * target_state != TargetState :: Secured ,
805
806
#[ cfg( windows) ]
806
807
exclude_paths,
@@ -851,7 +852,7 @@ where
851
852
relay_list_updater. update ( ) . await ;
852
853
853
854
let location_handler = GeoIpHandler :: new (
854
- api_runtime. rest_handle ( ) . await ,
855
+ api_runtime. rest_handle ( ) ,
855
856
internal_event_tx. clone ( ) . to_specialized_sender ( ) ,
856
857
) ;
857
858
@@ -1248,9 +1249,7 @@ where
1248
1249
GetCurrentAccessMethod ( tx) => self . on_get_current_api_access_method ( tx) ,
1249
1250
SetApiAccessMethod ( tx, method) => self . on_set_api_access_method ( tx, method) . await ,
1250
1251
TestApiAccessMethodById ( tx, method) => self . on_test_api_access_method ( tx, method) . await ,
1251
- TestCustomApiAccessMethod ( tx, proxy) => {
1252
- self . on_test_proxy_as_access_method ( tx, proxy) . await
1253
- }
1252
+ TestCustomApiAccessMethod ( tx, proxy) => self . on_test_proxy_as_access_method ( tx, proxy) ,
1254
1253
IsPerformingPostUpgrade ( tx) => self . on_is_performing_post_upgrade ( tx) ,
1255
1254
GetCurrentVersion ( tx) => self . on_get_current_version ( tx) ,
1256
1255
#[ cfg( not( target_os = "android" ) ) ]
@@ -2478,7 +2477,7 @@ where
2478
2477
} ) ;
2479
2478
}
2480
2479
2481
- async fn on_test_proxy_as_access_method (
2480
+ fn on_test_proxy_as_access_method (
2482
2481
& mut self ,
2483
2482
tx : ResponseTx < bool , Error > ,
2484
2483
proxy : talpid_types:: net:: proxy:: CustomProxy ,
@@ -2487,7 +2486,7 @@ where
2487
2486
use talpid_types:: net:: AllowedEndpoint ;
2488
2487
2489
2488
let connection_mode = ApiConnectionMode :: Proxied ( ProxyConfig :: from ( proxy. clone ( ) ) ) ;
2490
- let api_proxy = self . create_limited_api_proxy ( connection_mode. clone ( ) ) . await ;
2489
+ let api_proxy = self . create_limited_api_proxy ( connection_mode. clone ( ) ) ;
2491
2490
let proxy_endpoint = AllowedEndpoint {
2492
2491
endpoint : proxy. get_remote_endpoint ( ) . endpoint ,
2493
2492
clients : api:: allowed_clients ( & connection_mode) ,
@@ -2533,9 +2532,7 @@ where
2533
2532
}
2534
2533
} ;
2535
2534
2536
- let api_proxy = self
2537
- . create_limited_api_proxy ( test_subject. connection_mode )
2538
- . await ;
2535
+ let api_proxy = self . create_limited_api_proxy ( test_subject. connection_mode ) ;
2539
2536
let daemon_event_sender = self . tx . to_specialized_sender ( ) ;
2540
2537
let access_method_selector = self . connection_modes_handler . clone ( ) ;
2541
2538
0 commit comments