Skip to content

Commit

Permalink
Temporarily switch to local fork of tokio-uds's stream.rs until upstr…
Browse files Browse the repository at this point in the history
…eam PR 1294 is resolved.
  • Loading branch information
kinetiknz committed Jul 23, 2019
1 parent ddc8e95 commit ca41acd
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 16 deletions.
4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[workspace]
members = ["audioipc", "client", "server", "ipctest"]

[patch.crates-io]
tokio = { git = "https://github.com/kinetiknz/tokio", branch = "v0.1.x-uds" }
tokio-io = { git = "https://github.com/kinetiknz/tokio", branch = "v0.1.x-uds" }
tokio-uds = { git = "https://github.com/kinetiknz/tokio", branch = "v0.1.x-uds" }
3 changes: 2 additions & 1 deletion audioipc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ scoped-tls = "0.1"
serde = "1.*.*"
serde_derive = "1.*.*"
tokio-io = "0.1"
tokio-uds = "0.2.5"
tokio = "0.1"
tokio-reactor = "0.1"
winapi = "0.3.6"
mio = "0.6.19"
mio-uds = "0.6.7"
mio-named-pipes = { git = "https://github.com/alexcrichton/mio-named-pipes" }
tokio-named-pipes = { git = "https://github.com/NikVolf/tokio-named-pipes", branch = "stable" }

Expand Down
8 changes: 7 additions & 1 deletion audioipc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ extern crate memmap;
extern crate serde;
#[macro_use]
extern crate tokio_io;
extern crate tokio_uds;
extern crate tokio;
extern crate tokio_reactor;
#[cfg(windows)]
extern crate winapi;
extern crate mio;
#[cfg(unix)]
extern crate mio_uds;
#[cfg(windows)]
extern crate mio_named_pipes;
#[cfg(windows)]
Expand Down Expand Up @@ -56,6 +58,10 @@ mod msg;
pub mod rpc;
pub mod shm;

// TODO: Remove local fork when https://github.com/tokio-rs/tokio/pull/1294 is resolved.
#[cfg(unix)]
mod tokio_uds_stream;

pub use messages::{ClientMessage, ServerMessage};
use std::env::temp_dir;
use std::path::PathBuf;
Expand Down
1 change: 1 addition & 0 deletions audioipc/src/messagestream_unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::os::unix::net;
use tokio_io::{AsyncRead, AsyncWrite};
use mio::Ready;
use futures::Poll;
use super::tokio_uds_stream as tokio_uds;

#[derive(Debug)]
pub struct MessageStream(net::UnixStream);
Expand Down
20 changes: 14 additions & 6 deletions audioipc/src/tokio_uds_stream.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use ucred::{self, UCred};
// Copied from tokio-uds/src/stream.rs revision 25e835c5b7e2cfeb9c22b1fd576844f6814a9477 (tokio-uds 0.2.5)
// License MIT per upstream: https://github.com/tokio-rs/tokio/blob/master/tokio-uds/LICENSE
// - Removed ucred for build simplicity
// - Added clear_{read,write}_ready per: https://github.com/tokio-rs/tokio/pull/1294

use tokio_io::{AsyncRead, AsyncWrite};
use tokio_reactor::{Handle, PollEvented};
Expand Down Expand Up @@ -96,11 +99,21 @@ impl UnixStream {
self.io.poll_read_ready(ready)
}

/// Clear read ready state.
pub fn clear_read_ready(&self, ready: mio::Ready) -> io::Result<()> {
self.io.clear_read_ready(ready)
}

/// Test whether this socket is ready to be written to or not.
pub fn poll_write_ready(&self) -> Poll<Ready, io::Error> {
self.io.poll_write_ready()
}

/// Clear write ready state.
pub fn clear_write_ready(&self) -> io::Result<()> {
self.io.clear_write_ready()
}

/// Returns the socket address of the local half of this connection.
pub fn local_addr(&self) -> io::Result<SocketAddr> {
self.io.get_ref().local_addr()
Expand All @@ -111,11 +124,6 @@ impl UnixStream {
self.io.get_ref().peer_addr()
}

/// Returns effective credentials of the process which called `connect` or `pair`.
pub fn peer_cred(&self) -> io::Result<UCred> {
ucred::get_peer_cred(self)
}

/// Returns the value of the `SO_ERROR` option.
pub fn take_error(&self) -> io::Result<Option<io::Error>> {
self.io.get_ref().take_error()
Expand Down
1 change: 0 additions & 1 deletion client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ futures-cpupool = { version="0.1.8", default-features=false }
libc = "0.2"
log = "0.4"
tokio = "0.1"
tokio-uds = "0.2.5"
audio_thread_priority = "0.15.0"
lazy_static = "1.2.0"
cfg-if = "0.1.0"
1 change: 0 additions & 1 deletion client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ extern crate futures_cpupool;
extern crate libc;
#[macro_use]
extern crate log;
extern crate tokio_uds;
extern crate tokio;
extern crate audio_thread_priority;
#[macro_use]
Expand Down
1 change: 0 additions & 1 deletion server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ log = "0.4"
slab = "0.3.0"
futures = "0.1.18"
tokio = "0.1"
tokio-uds = "0.2.5"
audio_thread_priority = "0.15.0"
lazy_static = "1.2.0"

Expand Down
1 change: 0 additions & 1 deletion server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ extern crate futures;
extern crate lazycell;
extern crate libc;
extern crate slab;
extern crate tokio_uds;
extern crate tokio;
extern crate audio_thread_priority;
#[macro_use]
Expand Down

0 comments on commit ca41acd

Please sign in to comment.