Skip to content

Commit

Permalink
net: reorganize crate in anticipation of #1264
Browse files Browse the repository at this point in the history
Space is made to add `tcp`, `udp`, `uds`, ... modules
  • Loading branch information
carllerche committed Aug 15, 2019
1 parent d0a8e5d commit 4fb549c
Show file tree
Hide file tree
Showing 28 changed files with 630 additions and 613 deletions.
2 changes: 1 addition & 1 deletion tokio-fs/examples/std-echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use futures_util::{FutureExt, SinkExt, StreamExt, TryFutureExt};
use tokio::codec::{FramedRead, FramedWrite, LinesCodec, LinesCodecError};
use tokio::future::ready;
use tokio_fs::{stderr, stdin, stdout};
use tokio_threadpool::Builder;
use tokio_executor::threadpool::Builder;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
Expand Down
8 changes: 7 additions & 1 deletion tokio/src/reactor.rs → tokio-net/src/driver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,10 @@
//! [`std::io::Read`]: https://doc.rust-lang.org/std/io/trait.Read.html
//! [`std::io::Write`]: https://doc.rust-lang.org/std/io/trait.Write.html

pub use tokio_net::{Handle, PollEvented, Reactor, Registration, Turn};
pub(crate) mod platform;
mod reactor;
mod registration;
mod sharded_rwlock;

pub use self::reactor::{Reactor, Handle, set_default};
pub use self::registration::Registration;
28 changes: 28 additions & 0 deletions tokio-net/src/driver/platform.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
pub(crate) use self::sys::*;

#[cfg(unix)]
mod sys {
use mio::unix::UnixReady;
use mio::Ready;

pub(crate) fn hup() -> Ready {
UnixReady::hup().into()
}

pub(crate) fn is_hup(ready: Ready) -> bool {
UnixReady::from(ready).is_hup()
}
}

#[cfg(windows)]
mod sys {
use mio::Ready;

pub(crate) fn hup() -> Ready {
Ready::empty()
}

pub(crate) fn is_hup(_: Ready) -> bool {
false
}
}

0 comments on commit 4fb549c

Please sign in to comment.