summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2022-03-04 09:54:28 +0100
committerDavid Lönnhager <david.l@mullvad.net>2022-03-14 12:08:53 +0100
commite7bcd784a7f25be8b3b50e75b8adfad446125bc7 (patch)
tree5d53ee51217718c135618c065d3730d8166338df
parent9f5bc87ab6afa7f0b1c98c5cd9a101f39875641f (diff)
downloadmullvadvpn-e7bcd784a7f25be8b3b50e75b8adfad446125bc7.tar.xz
mullvadvpn-e7bcd784a7f25be8b3b50e75b8adfad446125bc7.zip
Implement talpid sender for futures sender
-rw-r--r--mullvad-daemon/src/device.rs2
-rw-r--r--talpid-core/src/mpsc.rs6
2 files changed, 6 insertions, 2 deletions
diff --git a/mullvad-daemon/src/device.rs b/mullvad-daemon/src/device.rs
index c0dc1296fb..f4eba59d2d 100644
--- a/mullvad-daemon/src/device.rs
+++ b/mullvad-daemon/src/device.rs
@@ -1,4 +1,3 @@
-use crate::DaemonEventSender;
use chrono::{DateTime, Utc};
use futures::{
channel::{mpsc, oneshot},
@@ -18,7 +17,6 @@ use mullvad_types::{
use std::{
future::Future,
path::Path,
- sync::{Arc, Mutex},
time::{Duration, SystemTime},
};
use talpid_core::{
diff --git a/talpid-core/src/mpsc.rs b/talpid-core/src/mpsc.rs
index 050b90c81c..8c6424bc01 100644
--- a/talpid-core/src/mpsc.rs
+++ b/talpid-core/src/mpsc.rs
@@ -3,3 +3,9 @@ pub trait Sender<T> {
/// Sends an item over the underlying channel, failing only if the channel is closed.
fn send(&self, item: T) -> Result<(), ()>;
}
+
+impl<E> Sender<E> for futures::channel::mpsc::UnboundedSender<E> {
+ fn send(&self, content: E) -> Result<(), ()> {
+ self.unbounded_send(content).map_err(|_| ())
+ }
+}