mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-27 20:12:58 +01:00
Fix for non Unix OS (#69)
This commit is contained in:
parent
bd4c4cda8b
commit
2756bedc3d
@ -53,6 +53,7 @@ pub mod net {
|
|||||||
pub use tokio::net::{UnixDatagram, UnixListener, UnixStream};
|
pub use tokio::net::{UnixDatagram, UnixListener, UnixStream};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
pub use self::unix::*;
|
pub use self::unix::*;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,12 +11,15 @@ use crate::server::Server;
|
|||||||
#[derive(PartialEq, Clone, Copy, Debug)]
|
#[derive(PartialEq, Clone, Copy, Debug)]
|
||||||
pub(crate) enum Signal {
|
pub(crate) enum Signal {
|
||||||
/// SIGHUP
|
/// SIGHUP
|
||||||
|
#[cfg_attr(not(unix), allow(dead_code))]
|
||||||
Hup,
|
Hup,
|
||||||
/// SIGINT
|
/// SIGINT
|
||||||
Int,
|
Int,
|
||||||
/// SIGTERM
|
/// SIGTERM
|
||||||
|
#[cfg_attr(not(unix), allow(dead_code))]
|
||||||
Term,
|
Term,
|
||||||
/// SIGQUIT
|
/// SIGQUIT
|
||||||
|
#[cfg_attr(not(unix), allow(dead_code))]
|
||||||
Quit,
|
Quit,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +72,7 @@ impl Future for Signals {
|
|||||||
#[cfg(not(unix))]
|
#[cfg(not(unix))]
|
||||||
loop {
|
loop {
|
||||||
match Pin::new(&mut self.stream).poll_next(cx) {
|
match Pin::new(&mut self.stream).poll_next(cx) {
|
||||||
Poll::Ready(Ok(Some(_))) => self.srv.signal(Signal::Int),
|
Poll::Ready(Some(_)) => self.srv.signal(Signal::Int),
|
||||||
Poll::Ready(None) => return Poll::Ready(()),
|
Poll::Ready(None) => return Poll::Ready(()),
|
||||||
Poll::Pending => return Poll::Pending,
|
Poll::Pending => return Poll::Pending,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user