summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/src/ipc.rs19
1 files changed, 15 insertions, 4 deletions
diff --git a/net/src/ipc.rs b/net/src/ipc.rs
index 56363ddc..ba962b70 100644
--- a/net/src/ipc.rs
+++ b/net/src/ipc.rs
@@ -110,8 +110,19 @@ impl Descriptor {
&self.ctx
}
- /// Connect to a descriptor, starting the server if necessary.
- pub fn connect(&self, handle: &tokio_core::reactor::Handle) -> io::Result<RpcSystem<Side>> {
+ /// Connects to a descriptor, starting the server if necessary.
+ pub fn connect(&self, handle: &tokio_core::reactor::Handle)
+ -> io::Result<RpcSystem<Side>> {
+ self.connect_with_policy(handle, *self.ctx.ipc_policy())
+ }
+
+ /// Connects to a descriptor, starting the server if necessary.
+ ///
+ /// This function does not use the contexts IPC policy, but uses
+ /// the given one.
+ pub fn connect_with_policy(&self, handle: &tokio_core::reactor::Handle,
+ policy: core::IPCPolicy)
+ -> io::Result<RpcSystem<Side>> {
let do_connect =
move |cookie: Cookie, mut s: TcpStream| -> io::Result<RpcSystem<Side>> {
cookie.send(&mut s)?;
@@ -163,7 +174,7 @@ impl Descriptor {
let cookie = Cookie::new()?;
for external in [true, false].iter() {
// Implement the IPC pocicy.
- if *self.ctx.ipc_policy() == core::IPCPolicy::Internal && *external {
+ if policy == core::IPCPolicy::Internal && *external {
// Do not try to fork.
continue;
}
@@ -171,7 +182,7 @@ impl Descriptor {
let addr = match self.start(*external) {
Ok(a) => a,
Err(e) => if *external {
- if *self.ctx.ipc_policy() == core::IPCPolicy::External {
+ if policy == core::IPCPolicy::External {
// Fail!
return Err(e);
}