diff options
| author | Erik Larkö <erik@mullvad.net> | 2017-03-22 22:15:16 +0800 |
|---|---|---|
| committer | Erik Larkö <erik@mullvad.net> | 2017-03-22 22:16:59 +0800 |
| commit | d32e3609e21498842f5da2aae5ae14373f0337d5 (patch) | |
| tree | 69558d92e9fd9242ac1c082f4d497efa12f22249 /talpid_ipc/src | |
| parent | 258de4f4594740566641c2c3fa94f6c73c5980a2 (diff) | |
| download | mullvadvpn-d32e3609e21498842f5da2aae5ae14373f0337d5.tar.xz mullvadvpn-d32e3609e21498842f5da2aae5ae14373f0337d5.zip | |
Remove the http ipc client
Diffstat (limited to 'talpid_ipc/src')
| -rw-r--r-- | talpid_ipc/src/http_ipc.rs | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/talpid_ipc/src/http_ipc.rs b/talpid_ipc/src/http_ipc.rs index 1cd675a990..f63c15e159 100644 --- a/talpid_ipc/src/http_ipc.rs +++ b/talpid_ipc/src/http_ipc.rs @@ -1,6 +1,5 @@ extern crate tiny_http; extern crate serde_json; -extern crate hyper; use super::{ErrorKind, Result, ResultExt, IpcServerId}; use serde; @@ -58,44 +57,4 @@ fn send_response<U: serde::Serialize>(response: &U, request: tiny_http::Request) request.respond(tiny_http::Response::from_string(response_as_string)) .chain_err(|| "Failed responding to HTTP request") }) -} - -pub struct IpcClient<T, U> - where T: serde::Serialize, - U: serde::Deserialize -{ - server_id: IpcServerId, - client: hyper::Client, - _phantom_t: ::std::marker::PhantomData<T>, - _phantom_u: ::std::marker::PhantomData<U>, -} - -impl<T, U> IpcClient<T, U> - where T: serde::Serialize, - U: serde::Deserialize -{ - pub fn new(server_id: IpcServerId) -> Self { - IpcClient { - server_id: server_id, - client: hyper::Client::new(), - _phantom_t: ::std::marker::PhantomData, - _phantom_u: ::std::marker::PhantomData, - } - } - - pub fn send(&mut self, message: &T) -> Result<U> { - let message_json = serde_json::to_string(message).chain_err(|| ErrorKind::ParseFailure)?; - debug!("HTTP IPC sending {}", message_json); - let mut reply = self.client - .post(&self.server_id) - .body(&message_json) - .send() - .chain_err(|| ErrorKind::SendError)?; - - Self::parse_reply(&mut reply) - } - - fn parse_reply(reply: &mut hyper::client::response::Response) -> Result<U> { - serde_json::from_reader(reply).chain_err(|| ErrorKind::ParseFailure) - } -} +}
\ No newline at end of file |
