summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2019-03-28 11:19:44 +0100
committerLinus Färnstrand <linus@mullvad.net>2019-03-28 15:19:10 +0100
commitf2d903de44c639fbe25f86b29a471176cd7882f6 (patch)
tree85b2605a6a4444e3d734f41514b5b224d6fc3319
parent34e0808f0c8446ece987f05a5b8aa8926f68b962 (diff)
downloadmullvadvpn-f2d903de44c639fbe25f86b29a471176cd7882f6.tar.xz
mullvadvpn-f2d903de44c639fbe25f86b29a471176cd7882f6.zip
Fix ownership of Settings in notify_settings
-rw-r--r--mullvad-daemon/src/lib.rs18
-rw-r--r--mullvad-daemon/src/management_interface.rs4
2 files changed, 11 insertions, 11 deletions
diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs
index 7a4e4b9943..46bef5d3e6 100644
--- a/mullvad-daemon/src/lib.rs
+++ b/mullvad-daemon/src/lib.rs
@@ -585,7 +585,7 @@ impl Daemon {
Self::oneshot_send(tx, (), "set_account response");
if account_changed {
self.management_interface_broadcaster
- .notify_settings(&self.settings);
+ .notify_settings(self.settings.clone());
match account_token {
Some(token) => {
if let Err(e) = self.account_history.bump_history(&token) {
@@ -651,7 +651,7 @@ impl Daemon {
Self::oneshot_send(tx, (), "update_relay_settings response");
if settings_changed {
self.management_interface_broadcaster
- .notify_settings(&self.settings);
+ .notify_settings(self.settings.clone());
info!("Initiating tunnel restart because the relay settings changed");
self.reconnect_tunnel();
}
@@ -667,7 +667,7 @@ impl Daemon {
Self::oneshot_send(tx, (), "set_allow_lan response");
if settings_changed {
self.management_interface_broadcaster
- .notify_settings(&self.settings);
+ .notify_settings(self.settings.clone());
self.send_tunnel_command(TunnelCommand::AllowLan(allow_lan));
}
}
@@ -688,7 +688,7 @@ impl Daemon {
Self::oneshot_send(tx, (), "set_block_when_disconnected response");
if settings_changed {
self.management_interface_broadcaster
- .notify_settings(&self.settings);
+ .notify_settings(self.settings.clone());
self.send_tunnel_command(TunnelCommand::BlockWhenDisconnected(
block_when_disconnected,
));
@@ -705,7 +705,7 @@ impl Daemon {
Self::oneshot_send(tx, (), "set auto-connect response");
if settings_changed {
self.management_interface_broadcaster
- .notify_settings(&self.settings);
+ .notify_settings(self.settings.clone());
}
}
Err(e) => error!("{}", e.display_chain()),
@@ -719,7 +719,7 @@ impl Daemon {
Self::oneshot_send(tx, (), "set_openvpn_mssfix response");
if settings_changed {
self.management_interface_broadcaster
- .notify_settings(&self.settings);
+ .notify_settings(self.settings.clone());
info!("Initiating tunnel restart because the OpenVPN mssfix setting changed");
self.reconnect_tunnel();
}
@@ -744,7 +744,7 @@ impl Daemon {
Self::oneshot_send(tx, Ok(()), "set_openvpn_proxy response");
if proxy_changed || constraints_changed {
self.management_interface_broadcaster
- .notify_settings(&self.settings);
+ .notify_settings(self.settings.clone());
info!("Initiating tunnel restart because the OpenVPN proxy setting changed");
self.reconnect_tunnel();
}
@@ -786,7 +786,7 @@ impl Daemon {
Self::oneshot_send(tx, (), "set_enable_ipv6 response");
if settings_changed {
self.management_interface_broadcaster
- .notify_settings(&self.settings);
+ .notify_settings(self.settings.clone());
info!("Initiating tunnel restart because the enable IPv6 setting changed");
self.reconnect_tunnel();
}
@@ -802,7 +802,7 @@ impl Daemon {
Self::oneshot_send(tx, (), "set_wireguard_mtu response");
if settings_changed {
self.management_interface_broadcaster
- .notify_settings(&self.settings);
+ .notify_settings(self.settings.clone());
info!("Initiating tunnel restart because the WireGuard MTU setting changed");
self.reconnect_tunnel();
}
diff --git a/mullvad-daemon/src/management_interface.rs b/mullvad-daemon/src/management_interface.rs
index f77cd1b8e4..17da57f37a 100644
--- a/mullvad-daemon/src/management_interface.rs
+++ b/mullvad-daemon/src/management_interface.rs
@@ -283,9 +283,9 @@ impl EventBroadcaster {
}
/// Sends settings to all `settings` subscribers of the management interface.
- pub fn notify_settings(&self, settings: &Settings) {
+ pub fn notify_settings(&self, settings: Settings) {
log::debug!("Broadcasting new settings");
- self.notify(DaemonEvent::Settings(settings.clone()));
+ self.notify(DaemonEvent::Settings(settings));
}
fn notify(&self, value: DaemonEvent) {