diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2017-05-19 06:33:09 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2017-05-23 08:53:41 +0200 |
| commit | 5aec5083c43131affe4db4b8e305164507b80e0b (patch) | |
| tree | d5bda6d81f0168cad9c19220be09b97f4207cc74 /talpid_openvpn_plugin/src | |
| parent | 078b706f309253c9cd97b2689c5505d198acc52d (diff) | |
| download | mullvadvpn-5aec5083c43131affe4db4b8e305164507b80e0b.tar.xz mullvadvpn-5aec5083c43131affe4db4b8e305164507b80e0b.zip | |
Use WsIpcClient in OpenVPN plugin
Diffstat (limited to 'talpid_openvpn_plugin/src')
| -rw-r--r-- | talpid_openvpn_plugin/src/lib.rs | 1 | ||||
| -rw-r--r-- | talpid_openvpn_plugin/src/processing.rs | 17 |
2 files changed, 8 insertions, 10 deletions
diff --git a/talpid_openvpn_plugin/src/lib.rs b/talpid_openvpn_plugin/src/lib.rs index f97394ec32..55102d111c 100644 --- a/talpid_openvpn_plugin/src/lib.rs +++ b/talpid_openvpn_plugin/src/lib.rs @@ -1,6 +1,5 @@ #[macro_use] extern crate error_chain; - #[macro_use] extern crate log; extern crate env_logger; diff --git a/talpid_openvpn_plugin/src/processing.rs b/talpid_openvpn_plugin/src/processing.rs index b1f1b97abc..dd6967135e 100644 --- a/talpid_openvpn_plugin/src/processing.rs +++ b/talpid_openvpn_plugin/src/processing.rs @@ -1,9 +1,6 @@ use openvpn_ffi; -use std::collections::HashMap; - -use talpid_ipc::{IpcClient, IpcServerId}; - +use talpid_ipc::{IpcServerId, WsIpcClient}; error_chain! { errors { @@ -16,22 +13,24 @@ error_chain! { /// Struct processing OpenVPN events and notifies listeners over IPC pub struct EventProcessor { - ipc_client: IpcClient<(openvpn_ffi::OpenVpnPluginEvent, HashMap<String, String>)>, + ipc_client: WsIpcClient, } impl EventProcessor { pub fn new(server_id: IpcServerId) -> Result<EventProcessor> { debug!("Creating EventProcessor"); - let ipc_client = IpcClient::new(server_id); - Ok(EventProcessor { ipc_client: ipc_client }) + let ipc_client = WsIpcClient::new(server_id).chain_err(|| "Unable to create IPC client")?; + Ok(EventProcessor { ipc_client }) } pub fn process_event(&mut self, event: openvpn_ffi::OpenVpnPluginEvent, - env: HashMap<String, String>) + env: openvpn_ffi::OpenVpnEnv) -> Result<()> { trace!("Processing \"{:?}\" event", event); - self.ipc_client.send(&(event, env)).chain_err(|| ErrorKind::IpcSendingError) + self.ipc_client + .call("openvpn_event", &(event, env)) + .chain_err(|| ErrorKind::IpcSendingError) } } |
