diff options
| author | David Lönnhager <david.l@mullvad.net> | 2020-09-07 16:15:10 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2020-09-07 16:42:18 +0200 |
| commit | db25c9c9ec03c22a2b6d3cb0ed6268547d64ec40 (patch) | |
| tree | 340e1809d8cedf3e92db2c30c0f941359e715629 | |
| parent | 3923c6320152e12b01b52cbff9408a0bb80e057a (diff) | |
| download | mullvadvpn-db25c9c9ec03c22a2b6d3cb0ed6268547d64ec40.tar.xz mullvadvpn-db25c9c9ec03c22a2b6d3cb0ed6268547d64ec40.zip | |
Fix deadlock in the problem report tool
| -rw-r--r-- | Cargo.lock | 1 | ||||
| -rw-r--r-- | mullvad-problem-report/Cargo.toml | 1 | ||||
| -rw-r--r-- | mullvad-problem-report/src/lib.rs | 8 | ||||
| -rw-r--r-- | mullvad-rpc/src/lib.rs | 6 |
4 files changed, 6 insertions, 10 deletions
diff --git a/Cargo.lock b/Cargo.lock index 0e500478ab..6503332d77 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1223,7 +1223,6 @@ dependencies = [ "duct 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "err-derive 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "mullvad-paths 0.1.0", "mullvad-rpc 0.1.0", diff --git a/mullvad-problem-report/Cargo.toml b/mullvad-problem-report/Cargo.toml index d7738b52de..d73a5fc08b 100644 --- a/mullvad-problem-report/Cargo.toml +++ b/mullvad-problem-report/Cargo.toml @@ -12,7 +12,6 @@ clap = "2.25" dirs = "2.0" env_logger = "0.7" err-derive = "0.2.1" -futures01 = { version = "0.1", package = "futures" } lazy_static = "1.0" regex = "1.0" uuid = { version = "0.8", features = ["v4"] } diff --git a/mullvad-problem-report/src/lib.rs b/mullvad-problem-report/src/lib.rs index 4265d70268..1c3fa00461 100644 --- a/mullvad-problem-report/src/lib.rs +++ b/mullvad-problem-report/src/lib.rs @@ -1,6 +1,5 @@ #![deny(rust_2018_idioms)] -use futures01::Future; use lazy_static::lazy_static; use regex::Regex; use std::{ @@ -266,7 +265,7 @@ pub fn send_problem_report( let metadata = ProblemReport::parse_metadata(&report_content).unwrap_or_else(|| metadata::collect()); - let runtime = tokio::runtime::Builder::new() + let mut runtime = tokio::runtime::Builder::new() .basic_scheduler() .enable_all() .build() @@ -276,9 +275,8 @@ pub fn send_problem_report( .map_err(Error::CreateRpcClientError)?; let rpc_client = mullvad_rpc::ProblemReportProxy::new(rpc_manager.mullvad_rest_handle()); - rpc_client - .problem_report(user_email, user_message, &report_content, &metadata) - .wait() + runtime + .block_on(rpc_client.problem_report(user_email, user_message, &report_content, &metadata)) .map_err(Error::SendRpcError) } diff --git a/mullvad-rpc/src/lib.rs b/mullvad-rpc/src/lib.rs index 5e2e6f80fa..ad41e0b5c3 100644 --- a/mullvad-rpc/src/lib.rs +++ b/mullvad-rpc/src/lib.rs @@ -230,7 +230,7 @@ impl ProblemReportProxy { message: &str, log: &str, metadata: &BTreeMap<String, String>, - ) -> impl Future01<Item = (), Error = rest::Error> { + ) -> impl Future<Output = Result<(), rest::Error>> { #[derive(serde::Serialize)] struct ProblemReport { address: String, @@ -257,10 +257,10 @@ impl ProblemReportProxy { StatusCode::NO_CONTENT, ); - self.handle.service.compat_spawn(async move { + async move { request.await?; Ok(()) - }) + } } } |
