File tree 2 files changed +9
-0
lines changed
2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ struct InitMutableBufferError: Error {
32
32
let description = " Failed to allocate memory for mutable buffer "
33
33
}
34
34
35
+ /// - Warning: Do not change the `apiAddress` or the `hostname` after the time `MullvadApi.init` has been invoked
36
+ /// The Mullvad API crate is using a global static variable to store those. They will be initialized only once.
37
+ ///
35
38
class MullvadApi {
36
39
private var clientContext = MullvadApiClient ( )
37
40
Original file line number Diff line number Diff line change @@ -68,6 +68,12 @@ impl FfiClient {
68
68
)
69
69
} ) ?;
70
70
71
+ // The call site guarantees that
72
+ // api_hostname and api_address will never change after the first call to new.
73
+ std:: env:: set_var ( crate :: env:: API_HOST_VAR , & api_hostname) ;
74
+ std:: env:: set_var ( crate :: env:: API_ADDR_VAR , & addr_str) ;
75
+ std:: env:: set_var ( crate :: env:: API_FORCE_DIRECT_VAR , "0" ) ;
76
+ std:: env:: set_var ( crate :: env:: DISABLE_TLS_VAR , "0" ) ;
71
77
let mut runtime_builder = tokio:: runtime:: Builder :: new_multi_thread ( ) ;
72
78
73
79
runtime_builder. worker_threads ( 2 ) . enable_all ( ) ;
You can’t perform that action at this time.
0 commit comments