diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-09-14 19:29:23 -0300 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-09-19 08:40:44 -0300 |
| commit | 898bfdcf3e201d37bb82c46412f2815d35ac8303 (patch) | |
| tree | 1d929a2352993afa249fd67c97d525010563cfa8 /talpid-core | |
| parent | a0fa03ffeab9fecff375f46f8aae7c89605c7717 (diff) | |
| download | mullvadvpn-898bfdcf3e201d37bb82c46412f2815d35ac8303.tar.xz mullvadvpn-898bfdcf3e201d37bb82c46412f2815d35ac8303.zip | |
Include after disconnect action in new state event
Diffstat (limited to 'talpid-core')
| -rw-r--r-- | talpid-core/src/tunnel_state_machine/disconnecting_state.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/talpid-core/src/tunnel_state_machine/disconnecting_state.rs b/talpid-core/src/tunnel_state_machine/disconnecting_state.rs index a7f20ca5ea..47467e3090 100644 --- a/talpid-core/src/tunnel_state_machine/disconnecting_state.rs +++ b/talpid-core/src/tunnel_state_machine/disconnecting_state.rs @@ -4,7 +4,7 @@ use error_chain::ChainedError; use futures::sync::{mpsc, oneshot}; use futures::{Async, Future, Stream}; -use talpid_types::tunnel::BlockReason; +use talpid_types::tunnel::{ActionAfterDisconnect, BlockReason}; use super::{ BlockedState, ConnectingState, DisconnectedState, EventConsequence, ResultExt, @@ -103,12 +103,14 @@ impl TunnelState for DisconnectingState { } }); + let action_after_disconnect = after_disconnect.action(); + ( TunnelStateWrapper::from(DisconnectingState { exited, after_disconnect, }), - TunnelStateTransition::Disconnecting, + TunnelStateTransition::Disconnecting(action_after_disconnect), ) } @@ -128,3 +130,14 @@ pub enum AfterDisconnect { Block(BlockReason, bool), Reconnect(TunnelParameters), } + +impl AfterDisconnect { + /// Build event representation of the action that will be taken after the disconnection. + pub fn action(&self) -> ActionAfterDisconnect { + match self { + AfterDisconnect::Nothing => ActionAfterDisconnect::Nothing, + AfterDisconnect::Block(..) => ActionAfterDisconnect::Block, + AfterDisconnect::Reconnect(_) => ActionAfterDisconnect::Reconnect, + } + } +} |
