summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2019-06-27 01:11:03 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2019-06-28 19:18:44 +0000
commitc975894e7a2023db98f13ea7a04904e8598f4a62 (patch)
treeee7042bf4ff14442565258c74de4d5aaf7ea842e
parentb89f4440aa899d976b2728503864f6b60fd4b3ba (diff)
downloadmullvadvpn-c975894e7a2023db98f13ea7a04904e8598f4a62.tar.xz
mullvadvpn-c975894e7a2023db98f13ea7a04904e8598f4a62.zip
Use `TunnelState` in `mullvad-daemon`
-rw-r--r--mullvad-daemon/src/lib.rs10
-rw-r--r--mullvad-daemon/src/management_interface.rs12
2 files changed, 11 insertions, 11 deletions
diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs
index 7a559624ec..ed950f29de 100644
--- a/mullvad-daemon/src/lib.rs
+++ b/mullvad-daemon/src/lib.rs
@@ -41,7 +41,7 @@ use mullvad_types::{
RelayConstraintsUpdate, RelaySettings, RelaySettingsUpdate, TunnelConstraints,
},
relay_list::{Relay, RelayList},
- states::TargetState,
+ states::{TargetState, TunnelState},
version::{AppVersion, AppVersionInfo},
wireguard::KeygenEvent,
};
@@ -146,7 +146,7 @@ enum DaemonExecutionState {
}
impl DaemonExecutionState {
- pub fn shutdown(&mut self, tunnel_state: &TunnelStateTransition) {
+ pub fn shutdown(&mut self, tunnel_state: &TunnelState) {
use self::DaemonExecutionState::*;
match self {
@@ -196,7 +196,7 @@ impl DaemonCommandSender {
/// Trait representing something that can broadcast daemon events.
pub trait EventListener {
/// Notify that the tunnel state changed.
- fn notify_new_state(&self, new_state: TunnelStateTransition);
+ fn notify_new_state(&self, new_state: TunnelState);
/// Notify that the settings changed.
fn notify_settings(&self, settings: Settings);
@@ -210,7 +210,7 @@ pub trait EventListener {
pub struct Daemon<L: EventListener = ManagementInterfaceEventBroadcaster> {
tunnel_command_tx: SyncUnboundedSender<TunnelCommand>,
- tunnel_state: TunnelStateTransition,
+ tunnel_state: TunnelState,
target_state: TargetState,
state: DaemonExecutionState,
rx: mpsc::Receiver<InternalDaemonEvent>,
@@ -766,7 +766,7 @@ where
Self::oneshot_send(tx, Ok(()), "target state");
}
- fn on_get_state(&self, tx: oneshot::Sender<TunnelStateTransition>) {
+ fn on_get_state(&self, tx: oneshot::Sender<TunnelState>) {
Self::oneshot_send(tx, self.tunnel_state.clone(), "current state");
}
diff --git a/mullvad-daemon/src/management_interface.rs b/mullvad-daemon/src/management_interface.rs
index 0ef34090d7..a2f0eb726b 100644
--- a/mullvad-daemon/src/management_interface.rs
+++ b/mullvad-daemon/src/management_interface.rs
@@ -18,7 +18,7 @@ use mullvad_types::{
relay_constraints::{BridgeSettings, BridgeState, RelaySettingsUpdate},
relay_list::RelayList,
settings::{self, Settings},
- states::TargetState,
+ states::{TargetState, TunnelState},
version, DaemonEvent,
};
use std::{
@@ -27,7 +27,7 @@ use std::{
};
use talpid_core::mpsc::IntoSender;
use talpid_ipc;
-use talpid_types::{net::wireguard, tunnel::TunnelStateTransition, ErrorExt};
+use talpid_types::{net::wireguard, ErrorExt};
use uuid;
/// FIXME(linus): This is here just because the futures crate has deprecated it and jsonrpc_core
@@ -87,7 +87,7 @@ build_rpc_trait! {
/// Returns the current state of the Mullvad client. Changes to this state will
/// be announced to subscribers of `new_state`.
#[rpc(meta, name = "get_state")]
- fn get_state(&self, Self::Metadata) -> BoxFuture<TunnelStateTransition, Error>;
+ fn get_state(&self, Self::Metadata) -> BoxFuture<TunnelState, Error>;
/// Performs a geoIP lookup and returns the current location as perceived by the public
/// internet.
@@ -172,7 +172,7 @@ pub enum ManagementCommand {
/// Change target state.
SetTargetState(OneshotSender<Result<(), ()>>, TargetState),
/// Request the current state.
- GetState(OneshotSender<TunnelStateTransition>),
+ GetState(OneshotSender<TunnelState>),
/// Get the current geographical location.
GetCurrentLocation(OneshotSender<Option<GeoIpLocation>>),
/// Request the metadata for an account.
@@ -280,7 +280,7 @@ pub struct ManagementInterfaceEventBroadcaster {
impl EventListener for ManagementInterfaceEventBroadcaster {
/// Sends a new state update to all `new_state` subscribers of the management interface.
- fn notify_new_state(&self, new_state: TunnelStateTransition) {
+ fn notify_new_state(&self, new_state: TunnelState) {
log::debug!("Broadcasting new state: {:?}", new_state);
self.notify(DaemonEvent::StateTransition(new_state));
}
@@ -492,7 +492,7 @@ impl<T: From<ManagementCommand> + 'static + Send> ManagementInterfaceApi
Box::new(future)
}
- fn get_state(&self, _: Self::Metadata) -> BoxFuture<TunnelStateTransition, Error> {
+ fn get_state(&self, _: Self::Metadata) -> BoxFuture<TunnelState, Error> {
log::debug!("get_state");
let (state_tx, state_rx) = sync::oneshot::channel();
let future = self