summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2019-07-09 14:07:40 +0200
committerLinus Färnstrand <linus@mullvad.net>2019-07-10 13:03:27 +0200
commitafc324dc5c8f29d225f36beed0732848b9a12ee5 (patch)
tree7dc674aac5b6bbab96f871dcadb019871eef382a
parent09103b9fcb3b5b998145a9fd000537d1e95d49f0 (diff)
downloadmullvadvpn-afc324dc5c8f29d225f36beed0732848b9a12ee5.tar.xz
mullvadvpn-afc324dc5c8f29d225f36beed0732848b9a12ee5.zip
Get rid of one layer of boxing
-rw-r--r--mullvad-daemon/src/management_interface.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/mullvad-daemon/src/management_interface.rs b/mullvad-daemon/src/management_interface.rs
index ecd012c440..a2eae7830d 100644
--- a/mullvad-daemon/src/management_interface.rs
+++ b/mullvad-daemon/src/management_interface.rs
@@ -335,8 +335,11 @@ impl<T: From<ManagementCommand> + 'static + Send> ManagementInterface<T> {
}
/// Sends a command to the daemon and maps the error to an RPC error.
- fn send_command_to_daemon(&self, command: ManagementCommand) -> BoxFuture<(), Error> {
- Box::new(future::result(self.tx.lock().send(command)).map_err(|_| Error::internal_error()))
+ fn send_command_to_daemon(
+ &self,
+ command: ManagementCommand,
+ ) -> impl Future<Item = (), Error = Error> {
+ future::result(self.tx.lock().send(command)).map_err(|_| Error::internal_error())
}
/// Converts the given error to an error that can be given to the caller of the API.
@@ -396,7 +399,7 @@ impl<T: From<ManagementCommand> + 'static + Send> ManagementInterfaceApi
fn update_relay_locations(&self, _: Self::Metadata) -> BoxFuture<(), Error> {
log::debug!("update_relay_locations");
- self.send_command_to_daemon(ManagementCommand::UpdateRelayLocations)
+ Box::new(self.send_command_to_daemon(ManagementCommand::UpdateRelayLocations))
}
fn set_account(
@@ -510,7 +513,7 @@ impl<T: From<ManagementCommand> + 'static + Send> ManagementInterfaceApi
fn shutdown(&self, _: Self::Metadata) -> BoxFuture<(), Error> {
log::debug!("shutdown");
- self.send_command_to_daemon(ManagementCommand::Shutdown)
+ Box::new(self.send_command_to_daemon(ManagementCommand::Shutdown))
}
fn get_account_history(&self, _: Self::Metadata) -> BoxFuture<Vec<AccountToken>, Error> {