summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorErik Larkö <erik@mullvad.net>2017-02-14 22:46:49 +0800
committerErik Larkö <erik@mullvad.net>2017-03-02 21:29:23 +0800
commitf720577fb80af171d3672c081297c8686e5d65f2 (patch)
tree08abf919869e92169f0767c217aee45534dcf766 /src
parent2fc9fa299a68b53277bead0909557c9b1a963702 (diff)
downloadmullvadvpn-f720577fb80af171d3672c081297c8686e5d65f2.tar.xz
mullvadvpn-f720577fb80af171d3672c081297c8686e5d65f2.zip
Use a non-functioning NOP impl of IpcServer for windows
Diffstat (limited to 'src')
-rw-r--r--src/ipc/mod.rs10
-rw-r--r--src/ipc/nop_ipc.rs17
-rw-r--r--src/ipc/zmq_ipc.rs (renamed from src/ipc/zmq.rs)5
-rw-r--r--src/lib.rs2
4 files changed, 29 insertions, 5 deletions
diff --git a/src/ipc/mod.rs b/src/ipc/mod.rs
index 26485f8260..afb140f4c6 100644
--- a/src/ipc/mod.rs
+++ b/src/ipc/mod.rs
@@ -1,4 +1,12 @@
-pub mod zmq;
+#[cfg(windows)]
+#[path = "nop_ipc.rs"]
+mod ipc_impl;
+
+#[cfg(not(windows))]
+#[path = "zmq_ipc.rs"]
+mod ipc_impl;
+
+pub use self::ipc_impl::*;
/// The type signature for functions accepting messages from the server.
/// If the server fails in delivering the message for any reason it will
diff --git a/src/ipc/nop_ipc.rs b/src/ipc/nop_ipc.rs
new file mode 100644
index 0000000000..78860cab95
--- /dev/null
+++ b/src/ipc/nop_ipc.rs
@@ -0,0 +1,17 @@
+/// This file only exists because we cannot get ZeroMQ to work on
+/// Windows. This is not a valid IPC implementation and us using
+/// it on Windows will result in a non-functioning client.
+///
+/// We plan on trying with ZMQ again in the future.
+/// Erik, 2017-02-09
+
+use ipc::{IpcServer, OnMessage, ErrorKind, Result};
+
+pub struct NopIpcServer;
+impl IpcServer for NopIpcServer {
+ type MessageType = String;
+
+ fn start(self, _port: u16, _on_message: Box<OnMessage<Self::MessageType>>) -> Result<()> {
+ Err(ErrorKind::CouldNotStartServer.into())
+ }
+}
diff --git a/src/ipc/zmq.rs b/src/ipc/zmq_ipc.rs
index 90492c159d..0dcc8d96ae 100644
--- a/src/ipc/zmq.rs
+++ b/src/ipc/zmq_ipc.rs
@@ -1,6 +1,7 @@
+extern crate zmq;
+
use ipc::{IpcServer, OnMessage, ErrorKind, Result, ResultExt};
use std::thread;
-use zmq;
/// The signature of functions that can be used to parse the incoming data
/// This is very very similar to `TryFrom` on purpose because I wanted `TryFrom`,
@@ -66,7 +67,7 @@ mod tests {
use std::result;
use std::sync::mpsc::{self, Receiver};
use std::time::Duration;
- use zmq;
+ extern crate zmq;
const A_VALID_MESSAGE: u8 = 1;
const AN_INVALID_MESSAGE: u8 = 2;
diff --git a/src/lib.rs b/src/lib.rs
index 6da4b115a1..1aa8b8d5f1 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,8 +11,6 @@ extern crate clonablechild;
#[macro_use]
extern crate error_chain;
-extern crate zmq;
-
/// Working with processes.
pub mod process;