summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-09-03 16:58:34 -0300
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-09-17 10:44:20 -0300
commit25afa242b0a3016a0458ab64f0b5260044743cb8 (patch)
tree35688a4842afde1dea61707c2049729288d71385
parente7c18ea031401b6595bf5ab48b0c16bbd99bd4f7 (diff)
downloadmullvadvpn-25afa242b0a3016a0458ab64f0b5260044743cb8.tar.xz
mullvadvpn-25afa242b0a3016a0458ab64f0b5260044743cb8.zip
Remove `Copy` impl. for `TunnelStateTransition`
-rw-r--r--mullvad-cli/src/cmds/status.rs6
-rw-r--r--mullvad-daemon/src/main.rs10
-rw-r--r--mullvad-ipc-client/src/lib.rs2
-rw-r--r--talpid-types/src/tunnel.rs4
4 files changed, 11 insertions, 11 deletions
diff --git a/mullvad-cli/src/cmds/status.rs b/mullvad-cli/src/cmds/status.rs
index 1266299c17..fbf4e23e1a 100644
--- a/mullvad-cli/src/cmds/status.rs
+++ b/mullvad-cli/src/cmds/status.rs
@@ -25,11 +25,11 @@ impl Command for Status {
let mut rpc = new_rpc_client()?;
let state = rpc.get_state()?;
- print_state(state);
+ print_state(&state);
print_location(&mut rpc)?;
if matches.subcommand_matches("listen").is_some() {
for new_state in rpc.new_state_subscribe()? {
- print_state(new_state);
+ print_state(&new_state);
if new_state == Connected || new_state == Disconnected {
print_location(&mut rpc)?;
@@ -40,7 +40,7 @@ impl Command for Status {
}
}
-fn print_state(state: TunnelStateTransition) {
+fn print_state(state: &TunnelStateTransition) {
print!("Tunnel status: ");
match state {
Blocked(reason) => println!("Blocked ({})", reason),
diff --git a/mullvad-daemon/src/main.rs b/mullvad-daemon/src/main.rs
index 8eb1a0348a..8f03a78170 100644
--- a/mullvad-daemon/src/main.rs
+++ b/mullvad-daemon/src/main.rs
@@ -141,7 +141,7 @@ enum DaemonExecutionState {
}
impl DaemonExecutionState {
- pub fn shutdown(&mut self, tunnel_state: TunnelStateTransition) {
+ pub fn shutdown(&mut self, tunnel_state: &TunnelStateTransition) {
use self::DaemonExecutionState::*;
match self {
@@ -336,9 +336,9 @@ impl Daemon {
_ => {}
}
- self.tunnel_state = tunnel_state;
+ self.tunnel_state = tunnel_state.clone();
self.management_interface_broadcaster
- .notify_new_state(self.tunnel_state);
+ .notify_new_state(tunnel_state);
}
fn handle_management_interface_event(&mut self, event: ManagementCommand) {
@@ -376,7 +376,7 @@ impl Daemon {
}
fn on_get_state(&self, tx: OneshotSender<TunnelStateTransition>) {
- Self::oneshot_send(tx, self.tunnel_state, "current state");
+ Self::oneshot_send(tx, self.tunnel_state.clone(), "current state");
}
fn on_get_current_location(&self, tx: OneshotSender<GeoIpLocation>) {
@@ -556,7 +556,7 @@ impl Daemon {
}
fn handle_trigger_shutdown_event(&mut self) {
- self.state.shutdown(self.tunnel_state);
+ self.state.shutdown(&self.tunnel_state);
self.disconnect_tunnel();
}
diff --git a/mullvad-ipc-client/src/lib.rs b/mullvad-ipc-client/src/lib.rs
index 813ec260b8..f7bc68da22 100644
--- a/mullvad-ipc-client/src/lib.rs
+++ b/mullvad-ipc-client/src/lib.rs
@@ -238,7 +238,7 @@ impl DaemonRpcClient {
.chain(polled)
.for_each(move |state| {
if state != current_state {
- current_state = state;
+ current_state = state.clone();
if tx.send(state).is_err() {
trace!("can't send new state to subscriber");
return Err(jsonrpc_client_core::ErrorKind::Shutdown.into());
diff --git a/talpid-types/src/tunnel.rs b/talpid-types/src/tunnel.rs
index bd275899f9..cce96f6354 100644
--- a/talpid-types/src/tunnel.rs
+++ b/talpid-types/src/tunnel.rs
@@ -1,7 +1,7 @@
use std::fmt;
/// Event resulting from a transition to a new tunnel state.
-#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
+#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[serde(tag = "state", content = "details")]
pub enum TunnelStateTransition {
@@ -27,7 +27,7 @@ impl TunnelStateTransition {
}
/// Reason for entering the blocked state.
-#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
+#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum BlockReason {
/// Authentication with remote server failed.