summaryrefslogtreecommitdiffhomepage
path: root/talpid_ipc/src
diff options
context:
space:
mode:
authorErik Larkö <erik@mullvad.net>2017-03-22 22:15:16 +0800
committerErik Larkö <erik@mullvad.net>2017-03-22 22:16:59 +0800
commitd32e3609e21498842f5da2aae5ae14373f0337d5 (patch)
tree69558d92e9fd9242ac1c082f4d497efa12f22249 /talpid_ipc/src
parent258de4f4594740566641c2c3fa94f6c73c5980a2 (diff)
downloadmullvadvpn-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.rs43
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