summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-11-19 15:55:17 +0100
committerLinus Färnstrand <linus@mullvad.net>2018-11-19 15:55:17 +0100
commit7b0a4354feef03bf686225837879017d0f269609 (patch)
tree5c17166b3626e08fea11f2282cf675128752550a
parent1ce6a645a1726b5ec543333a4a205d0b57c115f5 (diff)
parentd0cddd4a50f64bba5259b07af8799610ee935c80 (diff)
downloadmullvadvpn-7b0a4354feef03bf686225837879017d0f269609.tar.xz
mullvadvpn-7b0a4354feef03bf686225837879017d0f269609.zip
Merge branch 'handle-rpc-simpler'
-rw-r--r--CHANGELOG.md2
-rw-r--r--Cargo.lock1
-rw-r--r--mullvad-problem-report/Cargo.toml1
-rw-r--r--mullvad-problem-report/src/main.rs12
-rw-r--r--mullvad-rpc/src/https_client_with_sni.rs5
-rw-r--r--mullvad-rpc/src/lib.rs5
6 files changed, 15 insertions, 11 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index efeff0df33..2962415bba 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -42,6 +42,8 @@ Line wrap the file at 100 chars. Th
- Cancel pending system notifications when the app becomes visible.
- Transition to connected state after all routes are configured. Avoids problems with reaching the
internet directly after the app says it's connected.
+- Disable keep alive on API RPC requests. Should stop reuse of invalid sockets after tunnel state
+ changes.
#### Windows
- Use proper app id in the registry. This avoids false-positives with certain anti-virus software.
diff --git a/Cargo.lock b/Cargo.lock
index 9cb7e5c622..869ae86dab 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1004,6 +1004,7 @@ dependencies = [
"mullvad-rpc 0.1.0",
"regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rs-release 0.1.7 (git+https://github.com/mullvad/rs-release?branch=snailquote-unescape)",
+ "tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"uuid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"winres 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/mullvad-problem-report/Cargo.toml b/mullvad-problem-report/Cargo.toml
index 8c2160e018..4f6d7f3547 100644
--- a/mullvad-problem-report/Cargo.toml
+++ b/mullvad-problem-report/Cargo.toml
@@ -23,6 +23,7 @@ env_logger = "0.5"
error-chain = "0.12"
lazy_static = "1.0"
regex = "1.0"
+tokio-core = "0.1"
uuid = { version = "0.6", features = ["v4"] }
mullvad-paths = { path = "../mullvad-paths" }
diff --git a/mullvad-problem-report/src/main.rs b/mullvad-problem-report/src/main.rs
index 8e8fb00f67..183e5591d6 100644
--- a/mullvad-problem-report/src/main.rs
+++ b/mullvad-problem-report/src/main.rs
@@ -13,6 +13,7 @@ extern crate error_chain;
extern crate env_logger;
extern crate lazy_static;
extern crate regex;
+extern crate tokio_core;
extern crate uuid;
extern crate mullvad_paths;
@@ -22,6 +23,7 @@ use clap::crate_authors;
use error_chain::ChainedError;
use lazy_static::lazy_static;
use regex::Regex;
+use tokio_core::reactor::Core;
use std::{
alloc::System,
@@ -257,16 +259,16 @@ fn send_problem_report(user_email: &str, user_message: &str, report_path: &Path)
let ca_path = mullvad_paths::resources::get_api_ca_path();
+ let mut core = Core::new().unwrap();
let mut rpc_manager = mullvad_rpc::MullvadRpcFactory::new(ca_path);
let rpc_http_handle = rpc_manager
- .new_connection()
+ .new_connection_on_event_loop(&core.handle())
.chain_err(|| ErrorKind::RpcError)?;
let mut rpc_client = mullvad_rpc::ProblemReportProxy::new(rpc_http_handle);
- rpc_client
- .problem_report(user_email, user_message, &report_content, &metadata)
- .call()
- .chain_err(|| ErrorKind::RpcError)
+ let result =
+ core.run(rpc_client.problem_report(user_email, user_message, &report_content, &metadata));
+ result.chain_err(|| ErrorKind::RpcError)
}
fn write_problem_report(path: &Path, problem_report: &ProblemReport) -> io::Result<()> {
diff --git a/mullvad-rpc/src/https_client_with_sni.rs b/mullvad-rpc/src/https_client_with_sni.rs
index 8ec091ac47..62dc66df28 100644
--- a/mullvad-rpc/src/https_client_with_sni.rs
+++ b/mullvad-rpc/src/https_client_with_sni.rs
@@ -39,7 +39,10 @@ impl ClientCreator for HttpsClientWithSni {
fn create(&self, handle: &Handle) -> Result<Client<Self::Connect, Body>, Self::Error> {
let mut connector = HttpsConnectorWithSni::new(&self.ca_path, handle)?;
connector.set_sni_hostname(Some(self.sni_hostname.clone()));
- let client = Client::configure().connector(connector).build(handle);
+ let client = Client::configure()
+ .keep_alive(false)
+ .connector(connector)
+ .build(handle);
Ok(client)
}
}
diff --git a/mullvad-rpc/src/lib.rs b/mullvad-rpc/src/lib.rs
index 30215976e7..a5267e26db 100644
--- a/mullvad-rpc/src/lib.rs
+++ b/mullvad-rpc/src/lib.rs
@@ -88,11 +88,6 @@ impl MullvadRpcFactory {
}
}
- /// Spawns a tokio core on a new thread and returns a `HttpHandle` running on that core.
- pub fn new_connection(&mut self) -> Result<HttpHandle, HttpError> {
- self.setup_connection(HttpTransportBuilder::standalone)
- }
-
/// Create and returns a `HttpHandle` running on the given core handle.
pub fn new_connection_on_event_loop(
&mut self,