summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2017-05-18 15:17:38 +0200
committerLinus Färnstrand <linus@mullvad.net>2017-05-18 15:17:38 +0200
commit2f2c5b853ab376948e61e9f371cc724ac07ab5bb (patch)
treeeca27c93cc2457ba5d1b327804d4e065a893026b
parentb3ee3c1e75aa68462595aa9d80ea758b76d1aa82 (diff)
parent27e7c57d5305ff073aa2e299b5fcf7e08dad127f (diff)
downloadmullvadvpn-2f2c5b853ab376948e61e9f371cc724ac07ab5bb.tar.xz
mullvadvpn-2f2c5b853ab376948e61e9f371cc724ac07ab5bb.zip
Merge branch 'ipc-bind-zero'
-rw-r--r--Cargo.lock107
-rw-r--r--mullvad_daemon/Cargo.toml8
-rw-r--r--mullvad_daemon/src/main.rs1
-rw-r--r--mullvad_daemon/src/mock_ipc.rs27
-rw-r--r--openvpn_ffi/Cargo.toml4
-rw-r--r--talpid_ipc/Cargo.toml8
-rw-r--r--talpid_ipc/src/lib.rs15
-rw-r--r--talpid_ipc/src/nop_ipc.rs2
-rw-r--r--talpid_ipc/src/zmq_ipc.rs8
-rw-r--r--talpid_ipc/tests/zmq_integration_tests.rs2
10 files changed, 61 insertions, 121 deletions
diff --git a/Cargo.lock b/Cargo.lock
index b7d4c3f510..abbcc79fb3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -77,11 +77,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bytes"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "bytes"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
@@ -223,7 +218,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "jsonrpc-core"
version = "7.0.0"
-source = "git+https://github.com/paritytech/jsonrpc#05eca1e1dd80f9b3bd8f1738ca5680d078021c27"
+source = "git+https://github.com/faern/jsonrpc?branch=bind-zero#098cbc458d3f53b0ffa6a044674cf4379ec77ba2"
dependencies = [
"futures 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -235,19 +230,19 @@ dependencies = [
[[package]]
name = "jsonrpc-macros"
version = "7.0.0"
-source = "git+https://github.com/paritytech/jsonrpc#05eca1e1dd80f9b3bd8f1738ca5680d078021c27"
+source = "git+https://github.com/faern/jsonrpc?branch=bind-zero#098cbc458d3f53b0ffa6a044674cf4379ec77ba2"
dependencies = [
- "jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc)",
- "jsonrpc-pubsub 7.0.0 (git+https://github.com/paritytech/jsonrpc)",
+ "jsonrpc-core 7.0.0 (git+https://github.com/faern/jsonrpc?branch=bind-zero)",
+ "jsonrpc-pubsub 7.0.0 (git+https://github.com/faern/jsonrpc?branch=bind-zero)",
"serde 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "jsonrpc-pubsub"
version = "7.0.0"
-source = "git+https://github.com/paritytech/jsonrpc#05eca1e1dd80f9b3bd8f1738ca5680d078021c27"
+source = "git+https://github.com/faern/jsonrpc?branch=bind-zero#098cbc458d3f53b0ffa6a044674cf4379ec77ba2"
dependencies = [
- "jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc)",
+ "jsonrpc-core 7.0.0 (git+https://github.com/faern/jsonrpc?branch=bind-zero)",
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -255,10 +250,10 @@ dependencies = [
[[package]]
name = "jsonrpc-server-utils"
version = "7.0.0"
-source = "git+https://github.com/paritytech/jsonrpc#05eca1e1dd80f9b3bd8f1738ca5680d078021c27"
+source = "git+https://github.com/faern/jsonrpc?branch=bind-zero#098cbc458d3f53b0ffa6a044674cf4379ec77ba2"
dependencies = [
"globset 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc)",
+ "jsonrpc-core 7.0.0 (git+https://github.com/faern/jsonrpc?branch=bind-zero)",
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -267,12 +262,12 @@ dependencies = [
[[package]]
name = "jsonrpc-ws-server"
version = "7.0.0"
-source = "git+https://github.com/paritytech/jsonrpc#05eca1e1dd80f9b3bd8f1738ca5680d078021c27"
+source = "git+https://github.com/faern/jsonrpc?branch=bind-zero#098cbc458d3f53b0ffa6a044674cf4379ec77ba2"
dependencies = [
- "jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc)",
- "jsonrpc-server-utils 7.0.0 (git+https://github.com/paritytech/jsonrpc)",
+ "jsonrpc-core 7.0.0 (git+https://github.com/faern/jsonrpc?branch=bind-zero)",
+ "jsonrpc-server-utils 7.0.0 (git+https://github.com/faern/jsonrpc?branch=bind-zero)",
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "ws 0.6.0 (git+https://github.com/tomusdrw/ws-rs)",
+ "ws 0.7.1 (git+https://github.com/faern/ws-rs?branch=arbitrary-handshake-responses)",
]
[[package]]
@@ -361,10 +356,10 @@ dependencies = [
"assert_matches 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc)",
- "jsonrpc-macros 7.0.0 (git+https://github.com/paritytech/jsonrpc)",
- "jsonrpc-pubsub 7.0.0 (git+https://github.com/paritytech/jsonrpc)",
- "jsonrpc-ws-server 7.0.0 (git+https://github.com/paritytech/jsonrpc)",
+ "jsonrpc-core 7.0.0 (git+https://github.com/faern/jsonrpc?branch=bind-zero)",
+ "jsonrpc-macros 7.0.0 (git+https://github.com/faern/jsonrpc?branch=bind-zero)",
+ "jsonrpc-pubsub 7.0.0 (git+https://github.com/faern/jsonrpc?branch=bind-zero)",
+ "jsonrpc-ws-server 7.0.0 (git+https://github.com/faern/jsonrpc?branch=bind-zero)",
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -405,8 +400,8 @@ version = "0.1.0"
dependencies = [
"assert_matches 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.9.13 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 0.9.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -496,33 +491,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde"
-version = "0.9.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "serde"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
-name = "serde_codegen_internals"
-version = "0.14.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "syn 0.11.10 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "serde_derive"
-version = "0.9.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_codegen_internals 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 0.11.10 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "serde_derive"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -543,17 +515,6 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "0.9.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "dtoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.9.13 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "serde_json"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
@@ -645,11 +606,11 @@ version = "0.1.0"
dependencies = [
"assert_matches 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc)",
- "jsonrpc-ws-server 7.0.0 (git+https://github.com/paritytech/jsonrpc)",
+ "jsonrpc-core 7.0.0 (git+https://github.com/faern/jsonrpc?branch=bind-zero)",
+ "jsonrpc-ws-server 7.0.0 (git+https://github.com/faern/jsonrpc?branch=bind-zero)",
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.9.13 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_json 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"zmq 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -783,10 +744,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "ws"
-version = "0.6.0"
-source = "git+https://github.com/tomusdrw/ws-rs#7f8e416b7f048880228005457e117128be38bf0f"
+version = "0.7.1"
+source = "git+https://github.com/faern/ws-rs?branch=arbitrary-handshake-responses#3a8c5ae37e0ff5aab4c0ad656a160eb0bf78f5c1"
dependencies = [
- "bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "bytes 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"httparse 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -834,7 +796,6 @@ dependencies = [
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
"checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4"
"checksum byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c40977b0ee6b9885c9013cd41d9feffdd22deb3bb4dc3a71d901cc7a77de18c8"
-"checksum bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c129aff112dcc562970abb69e2508b40850dd24c274761bb50fb8a0067ba6c27"
"checksum bytes 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3941933da81d8717b427c2ddc2d73567cd15adb6c57514a2726d9ee598a5439a"
"checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c"
"checksum clap 2.23.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf1114886d7cde2d6448517161d7db8d681a9a1c09f7d210f0b0864e48195f6"
@@ -853,11 +814,11 @@ dependencies = [
"checksum idna 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6ac85ec3f80c8e4e99d9325521337e14ec7555c458a14e377d189659a427f375"
"checksum iovec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "29d062ee61fccdf25be172e70f34c9f6efc597e1fb8f6526e8437b2046ab26be"
"checksum itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eb2f404fbc66fd9aac13e998248505e7ecb2ad8e44ab6388684c5fb11c6c251c"
-"checksum jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc)" = "<none>"
-"checksum jsonrpc-macros 7.0.0 (git+https://github.com/paritytech/jsonrpc)" = "<none>"
-"checksum jsonrpc-pubsub 7.0.0 (git+https://github.com/paritytech/jsonrpc)" = "<none>"
-"checksum jsonrpc-server-utils 7.0.0 (git+https://github.com/paritytech/jsonrpc)" = "<none>"
-"checksum jsonrpc-ws-server 7.0.0 (git+https://github.com/paritytech/jsonrpc)" = "<none>"
+"checksum jsonrpc-core 7.0.0 (git+https://github.com/faern/jsonrpc?branch=bind-zero)" = "<none>"
+"checksum jsonrpc-macros 7.0.0 (git+https://github.com/faern/jsonrpc?branch=bind-zero)" = "<none>"
+"checksum jsonrpc-pubsub 7.0.0 (git+https://github.com/faern/jsonrpc?branch=bind-zero)" = "<none>"
+"checksum jsonrpc-server-utils 7.0.0 (git+https://github.com/faern/jsonrpc?branch=bind-zero)" = "<none>"
+"checksum jsonrpc-ws-server 7.0.0 (git+https://github.com/faern/jsonrpc?branch=bind-zero)" = "<none>"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum lazycell 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce12306c4739d86ee97c23139f3a34ddf0387bbf181bc7929d287025a8c3ef6b"
"checksum lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3b585b7a6811fb03aa10e74b278a0f00f8dd9b45dc681f148bb29fa5cb61859b"
@@ -882,13 +843,9 @@ dependencies = [
"checksum regex-syntax 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9191b1f57603095f105d317e375d19b1c9c5c3185ea9633a99a6dcbed04457"
"checksum rustc-demangle 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3058a43ada2c2d0b92b3ae38007a2d0fa5e9db971be260e0171408a4ff471c95"
"checksum scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f417c22df063e9450888a7561788e9bd46d3bb3c1466435b4eccb903807f147d"
-"checksum serde 0.9.13 (registry+https://github.com/rust-lang/crates.io-index)" = "231dfd55909400769e437326cfb4af8bec97c3dd56ab3d02df8ef5c7e00f179b"
"checksum serde 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3b46a59dd63931010fdb1d88538513f3279090d88b5c22ef4fe8440cfffcc6e3"
-"checksum serde_codegen_internals 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bc888bd283bd2420b16ad0d860e35ad8acb21941180a83a189bb2046f9d00400"
-"checksum serde_derive 0.9.13 (registry+https://github.com/rust-lang/crates.io-index)" = "d75c72ef4dd193d89eb652b73890fe2489996c9ead8b37980f57a1078f96ed50"
"checksum serde_derive 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6c06b68790963518008b8ae0152d48be4bbbe77015d2c717f6282eea1824be9a"
"checksum serde_derive_internals 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "021c338d22c7e30f957a6ab7e388cb6098499dda9fd4ba1661ee074ca7a180d1"
-"checksum serde_json 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ad8bcf487be7d2e15d3d543f04312de991d631cfe1b43ea0ade69e6a8a5b16a1"
"checksum serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "48b04779552e92037212c3615370f6bd57a40ebba7f20e554ff9f55e41a69a7b"
"checksum sha1 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc30b1e1e8c40c121ca33b86c23308a090d19974ef001b4bf6e61fd1a0fb095c"
"checksum shared_child 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "099b38928dbe4a0a01fcd8c233183072f14a7d126a34bed05880869be66e14cc"
@@ -916,7 +873,7 @@ dependencies = [
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
-"checksum ws 0.6.0 (git+https://github.com/tomusdrw/ws-rs)" = "<none>"
+"checksum ws 0.7.1 (git+https://github.com/faern/ws-rs?branch=arbitrary-handshake-responses)" = "<none>"
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
"checksum zmq 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9623581b345b8a85fb72cae9b2cb67116d73ccb141e6c02f689e311962b74f9c"
"checksum zmq-sys 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ecf3aafc58984279d9b8f776703ef569d32ae386353192a267cd6e711da70dde"
diff --git a/mullvad_daemon/Cargo.toml b/mullvad_daemon/Cargo.toml
index c3f4e22ae5..9982a1bbaa 100644
--- a/mullvad_daemon/Cargo.toml
+++ b/mullvad_daemon/Cargo.toml
@@ -10,10 +10,10 @@ serde = "1.0"
serde_derive = "1.0"
log = "0.3"
env_logger = "0.4"
-jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc" }
-jsonrpc-macros = { git = "https://github.com/paritytech/jsonrpc" }
-jsonrpc-pubsub = { git = "https://github.com/paritytech/jsonrpc" }
-jsonrpc-ws-server = { git = "https://github.com/paritytech/jsonrpc" }
+jsonrpc-core = { git = "https://github.com/faern/jsonrpc", branch = "bind-zero" }
+jsonrpc-macros = { git = "https://github.com/faern/jsonrpc", branch = "bind-zero" }
+jsonrpc-pubsub = { git = "https://github.com/faern/jsonrpc", branch = "bind-zero" }
+jsonrpc-ws-server = { git = "https://github.com/faern/jsonrpc", branch = "bind-zero" }
[dependencies.talpid_ipc]
path = "../talpid_ipc"
diff --git a/mullvad_daemon/src/main.rs b/mullvad_daemon/src/main.rs
index 5bd9563bfd..95033b1564 100644
--- a/mullvad_daemon/src/main.rs
+++ b/mullvad_daemon/src/main.rs
@@ -27,6 +27,7 @@ fn run() -> Result<()> {
init_logger()?;
let server = start_ipc()?;
+ info!("Mullvad daemon listening on {}", server.address());
main_loop(server)
}
diff --git a/mullvad_daemon/src/mock_ipc.rs b/mullvad_daemon/src/mock_ipc.rs
index e490357741..dd76f8f8c0 100644
--- a/mullvad_daemon/src/mock_ipc.rs
+++ b/mullvad_daemon/src/mock_ipc.rs
@@ -21,17 +21,13 @@ pub struct IpcServer {
impl IpcServer {
pub fn start() -> talpid_ipc::Result<Self> {
let active_subscriptions = ActiveSubscriptions::default();
- let mut last_error = None;
- for i in 0..10 {
- match Self::try_start(active_subscriptions.clone(), i) {
- Ok(server) => {
- Self::spawn_broadcast_thread(active_subscriptions);
- return Ok(IpcServer { server });
- }
- Err(e) => last_error = Some(e),
- }
- }
- bail!(last_error.unwrap());
+ let rpc = MockIpcApi::new(active_subscriptions.clone());
+ let mut io = PubSubHandler::default();
+ io.extend_with(rpc.to_delegate());
+ let server = talpid_ipc::IpcServer::start_with_metadata(io.into(), meta_extractor)?;
+
+ Self::spawn_broadcast_thread(active_subscriptions);
+ Ok(IpcServer { server })
}
pub fn address(&self) -> &str {
@@ -42,15 +38,6 @@ impl IpcServer {
self.server.wait()
}
- fn try_start(active_subscriptions: ActiveSubscriptions,
- port_offset: u8)
- -> talpid_ipc::Result<talpid_ipc::IpcServer> {
- let rpc = MockIpcApi::new(active_subscriptions);
- let mut io = PubSubHandler::default();
- io.extend_with(rpc.to_delegate());
- talpid_ipc::IpcServer::start_with_metadata(io.into(), meta_extractor, port_offset)
- }
-
// TODO(linus): This thread will never die. But this is just mock anyway so not important.
fn spawn_broadcast_thread(active_subscriptions: ActiveSubscriptions) {
::std::thread::spawn(
diff --git a/openvpn_ffi/Cargo.toml b/openvpn_ffi/Cargo.toml
index 2c292fca94..062bf1f063 100644
--- a/openvpn_ffi/Cargo.toml
+++ b/openvpn_ffi/Cargo.toml
@@ -6,8 +6,8 @@ description = "Constants, enums and structs for interfacing with OpenVPN"
[dependencies]
error-chain = "0.10"
-serde = "0.9"
-serde_derive = "0.9"
+serde = "1.0"
+serde_derive = "1.0"
[dev-dependencies]
assert_matches = "1.0"
diff --git a/talpid_ipc/Cargo.toml b/talpid_ipc/Cargo.toml
index 3b3418b148..a0b24de4a3 100644
--- a/talpid_ipc/Cargo.toml
+++ b/talpid_ipc/Cargo.toml
@@ -6,11 +6,11 @@ description = "IPC client and server for talpid"
[dependencies]
error-chain = "0.10"
-serde = "0.9"
-serde_json = "0.9"
+serde = "1.0"
+serde_json = "1.0"
log = "0.3"
-jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc" }
-jsonrpc-ws-server = { git = "https://github.com/paritytech/jsonrpc" }
+jsonrpc-core = { git = "https://github.com/faern/jsonrpc", branch = "bind-zero" }
+jsonrpc-ws-server = { git = "https://github.com/faern/jsonrpc", branch = "bind-zero" }
[target.'cfg(not(windows))'.dependencies]
zmq = "0.8"
diff --git a/talpid_ipc/src/lib.rs b/talpid_ipc/src/lib.rs
index bad341bb32..8452a8db92 100644
--- a/talpid_ipc/src/lib.rs
+++ b/talpid_ipc/src/lib.rs
@@ -55,27 +55,22 @@ pub struct IpcServer {
}
impl IpcServer {
- pub fn start<M: Metadata>(handler: MetaIoHandler<M>, port_offset: u8) -> Result<Self> {
- Self::start_with_metadata(handler, NoopExtractor, port_offset)
+ pub fn start<M: Metadata>(handler: MetaIoHandler<M>) -> Result<Self> {
+ Self::start_with_metadata(handler, NoopExtractor)
}
- pub fn start_with_metadata<M, E>(handler: MetaIoHandler<M>,
- meta_extractor: E,
- port_offset: u8)
- -> Result<Self>
+ pub fn start_with_metadata<M, E>(handler: MetaIoHandler<M>, meta_extractor: E) -> Result<Self>
where M: Metadata,
E: MetaExtractor<M>
{
- let port = 5000 + port_offset as u16;
- let ip = IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1));
- let listen_addr = SocketAddr::new(ip, port);
+ let listen_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 0);
ServerBuilder::new(handler)
.session_meta_extractor(meta_extractor)
.start(&listen_addr)
.map(
|server| {
IpcServer {
- address: format!("ws://{}", listen_addr),
+ address: format!("ws://{}", server.addr()),
server: server,
}
},
diff --git a/talpid_ipc/src/nop_ipc.rs b/talpid_ipc/src/nop_ipc.rs
index f6ead2676b..8c7a24bc63 100644
--- a/talpid_ipc/src/nop_ipc.rs
+++ b/talpid_ipc/src/nop_ipc.rs
@@ -9,7 +9,7 @@ use serde;
/// We plan on trying with ZMQ again in the future.
/// Erik, 2017-02-09
pub fn start_new_server<T, F>(_on_message: F) -> Result<IpcServerId>
- where T: serde::Deserialize + 'static,
+ where for<'de> T: serde::Deserialize<'de> + 'static,
F: FnMut(Result<T>) + Send + 'static
{
bail!(ErrorKind::CouldNotStartServer);
diff --git a/talpid_ipc/src/zmq_ipc.rs b/talpid_ipc/src/zmq_ipc.rs
index 49aad9f699..35fe5e59a9 100644
--- a/talpid_ipc/src/zmq_ipc.rs
+++ b/talpid_ipc/src/zmq_ipc.rs
@@ -16,7 +16,7 @@ use std::thread;
///
/// This function is non-blocking and thus spawns a thread where it listens to messages.
pub fn start_new_server<T, F>(on_message: F) -> Result<IpcServerId>
- where T: serde::Deserialize + 'static,
+ where for<'de> T: serde::Deserialize<'de> + 'static,
F: FnMut(Result<T>) + Send + 'static
{
for port in 5000..5010 {
@@ -40,7 +40,7 @@ fn start_zmq_server(connection_string: &str) -> zmq::Result<zmq::Socket> {
}
fn start_receive_loop<T, F>(socket: zmq::Socket, mut on_message: F) -> thread::JoinHandle<()>
- where T: serde::Deserialize + 'static,
+ where for<'de> T: serde::Deserialize<'de> + 'static,
F: FnMut(Result<T>) + Send + 'static
{
thread::spawn(
@@ -54,8 +54,8 @@ fn start_receive_loop<T, F>(socket: zmq::Socket, mut on_message: F) -> thread::J
)
}
-fn parse_message<T>(message: &[u8]) -> Result<T>
- where T: serde::Deserialize + 'static
+fn parse_message<'a, T>(message: &'a [u8]) -> Result<T>
+ where T: serde::Deserialize<'a> + 'static
{
serde_json::from_slice(message).chain_err(|| ErrorKind::ParseFailure)
}
diff --git a/talpid_ipc/tests/zmq_integration_tests.rs b/talpid_ipc/tests/zmq_integration_tests.rs
index 4bd484cf0a..db9650f7a0 100644
--- a/talpid_ipc/tests/zmq_integration_tests.rs
+++ b/talpid_ipc/tests/zmq_integration_tests.rs
@@ -24,7 +24,7 @@ mod zmq_integration_tests {
}
fn start_server<T>() -> (IpcServerId, Receiver<Result<T>>)
- where T: serde::Deserialize + Send + 'static
+ where for<'de> T: serde::Deserialize<'de> + Send + 'static
{
let (tx, rx) = mpsc::channel();