diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2018-09-13 12:34:09 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2018-09-13 19:40:27 +0200 |
| commit | b63e19610cb17cc8589d6f194d2478d65e61d1d4 (patch) | |
| tree | f534269f814b6c57b887a31194958dae07c2b761 | |
| parent | b6980f9dfa45f358daba0bd3488c6616ddcc0643 (diff) | |
| download | mullvadvpn-b63e19610cb17cc8589d6f194d2478d65e61d1d4.tar.xz mullvadvpn-b63e19610cb17cc8589d6f194d2478d65e61d1d4.zip | |
Slightly restructure mullvad-ipc-client for readability
| -rw-r--r-- | mullvad-ipc-client/src/lib.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/mullvad-ipc-client/src/lib.rs b/mullvad-ipc-client/src/lib.rs index e0b6d0692a..813ec260b8 100644 --- a/mullvad-ipc-client/src/lib.rs +++ b/mullvad-ipc-client/src/lib.rs @@ -71,6 +71,16 @@ error_chain! { static NO_ARGS: [u8; 0] = []; + +pub fn new_standalone_ipc_client(path: &impl AsRef<Path>) -> Result<DaemonRpcClient> { + let path = path.as_ref().to_string_lossy().to_string(); + + new_standalone_transport(path, |path| { + IpcTransport::new(&path, &tokio::reactor::Handle::current()) + .chain_err(|| ErrorKind::TransportError) + }) +} + pub fn new_standalone_transport< F: Send + 'static + FnOnce(String) -> Result<T>, T: jsonrpc_client_core::Transport, @@ -98,15 +108,6 @@ pub fn new_standalone_transport< .map(|client_handle| DaemonRpcClient::new(client_handle)) } -pub fn new_standalone_ipc_client(path: &impl AsRef<Path>) -> Result<DaemonRpcClient> { - let path = path.as_ref().to_string_lossy().to_string(); - - new_standalone_transport(path, |path| { - IpcTransport::new(&path, &tokio::reactor::Handle::current()) - .chain_err(|| ErrorKind::TransportError) - }) -} - fn spawn_transport<F: Send + FnOnce(String) -> Result<T>, T: jsonrpc_client_core::Transport>( address: String, transport_func: F, |
