summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-08-30 13:09:31 -0300
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-08-30 16:45:46 -0300
commit2b95a194535462694378f37feb21223a7de2a8da (patch)
tree64cec402b697a4cafd8e351b04f95b7f779b32d8
parentd818ff9c4ec54540bf10b09d9668eb7ad33336a5 (diff)
downloadmullvadvpn-2b95a194535462694378f37feb21223a7de2a8da.tar.xz
mullvadvpn-2b95a194535462694378f37feb21223a7de2a8da.zip
Request tunnel to close in a separate thread
-rw-r--r--talpid-core/src/tunnel_state_machine/disconnecting_state.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/talpid-core/src/tunnel_state_machine/disconnecting_state.rs b/talpid-core/src/tunnel_state_machine/disconnecting_state.rs
index 5b80ad0598..0643fef13c 100644
--- a/talpid-core/src/tunnel_state_machine/disconnecting_state.rs
+++ b/talpid-core/src/tunnel_state_machine/disconnecting_state.rs
@@ -1,3 +1,5 @@
+use std::thread;
+
use error_chain::ChainedError;
use futures::sync::{mpsc, oneshot};
use futures::{Async, Future, Stream};
@@ -72,13 +74,15 @@ impl TunnelState for DisconnectingState {
_: &mut SharedTunnelStateValues,
(close_handle, exited, after_disconnect): Self::Bootstrap,
) -> StateEntryResult {
- let close_result = close_handle
- .close()
- .chain_err(|| "Failed to request tunnel monitor to close the tunnel");
+ thread::spawn(move || {
+ let close_result = close_handle
+ .close()
+ .chain_err(|| "Failed to close the tunnel");
- if let Err(error) = close_result {
- error!("{}", error.display_chain());
- }
+ if let Err(error) = close_result {
+ error!("{}", error.display_chain());
+ }
+ });
Ok(TunnelStateWrapper::from(DisconnectingState {
exited,