diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-08-31 07:11:30 -0300 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-08-31 07:11:30 -0300 |
| commit | 912c0b8d18c63e27cdd0f3863529ee9c3f8bd854 (patch) | |
| tree | 64cec402b697a4cafd8e351b04f95b7f779b32d8 /talpid-core/src | |
| parent | a7c3dc398dbd5cd8c86bec16e8ab96a5d7b21dd9 (diff) | |
| parent | 2b95a194535462694378f37feb21223a7de2a8da (diff) | |
| download | mullvadvpn-912c0b8d18c63e27cdd0f3863529ee9c3f8bd854.tar.xz mullvadvpn-912c0b8d18c63e27cdd0f3863529ee9c3f8bd854.zip | |
Merge branch 'state-transition-to-ui'
Diffstat (limited to 'talpid-core/src')
| -rw-r--r-- | talpid-core/src/tunnel_state_machine/disconnecting_state.rs | 16 | ||||
| -rw-r--r-- | talpid-core/src/tunnel_state_machine/mod.rs | 14 |
2 files changed, 11 insertions, 19 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, diff --git a/talpid-core/src/tunnel_state_machine/mod.rs b/talpid-core/src/tunnel_state_machine/mod.rs index c3d592c952..01a168e2b6 100644 --- a/talpid-core/src/tunnel_state_machine/mod.rs +++ b/talpid-core/src/tunnel_state_machine/mod.rs @@ -17,6 +17,7 @@ use futures::{Async, Future, Poll, Stream}; use tokio_core::reactor::Core; use talpid_types::net::{TunnelEndpoint, TunnelOptions}; +use talpid_types::tunnel::TunnelStateTransition; use self::connected_state::{ConnectedState, ConnectedStateBootstrap}; use self::connecting_state::ConnectingState; @@ -126,19 +127,6 @@ pub struct TunnelParameters { pub allow_lan: bool, } -/// Event resulting from a transition to a new tunnel state. -#[derive(Clone, Copy, Debug, PartialEq)] -pub enum TunnelStateTransition { - /// No connection is established and network is unsecured. - Disconnected, - /// Network is secured but tunnel is still connecting. - Connecting, - /// Tunnel is connected. - Connected, - /// Disconnecting tunnel. - Disconnecting, -} - /// Asynchronous handling of the tunnel state machine. /// /// This type implements `Stream`, and attempts to advance the state machine based on the events |
