Skip to content

Commit

Permalink
Fix building fail on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
sorz committed Dec 24, 2020
1 parent a79bb33 commit 9325d9b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use clap::{load_yaml, AppSettings};
use futures_util::{stream, StreamExt};
use ini::Ini;
use log::{debug, error, info, warn, LevelFilter};
use parking_lot::deadlock;
use std::{
collections::HashSet,
env,
Expand All @@ -23,16 +22,16 @@ use tokio::{

#[cfg(all(feature = "systemd", target_os = "linux"))]
use moproxy::systemd;
#[cfg(target_os = "linux")]
use moproxy::tcp::set_congestion;
#[cfg(feature = "web_console")]
use moproxy::web;
use moproxy::{
client::{Connectable, NewClient},
monitor::{Monitor, ServerList},
proxy::{ProxyProto, ProxyServer, UserPassAuthCredential},
stream::{TcpListenerStream, UnixListenerStream},
stream::TcpListenerStream,
};
#[cfg(target_os = "linux")]
use moproxy::{stream::UnixListenerStream, tcp::set_congestion};

trait FromOptionStr<E, T: FromStr<Err = E>> {
fn parse(&self) -> Result<Option<T>, E>;
Expand Down Expand Up @@ -177,7 +176,7 @@ async fn main() {
systemd::notify_realoding();

// feature: check deadlocks on signal
let deadlocks = deadlock::check_deadlock();
let deadlocks = parking_lot::deadlock::check_deadlock();
if !deadlocks.is_empty() {
error!("{} deadlocks detected!", deadlocks.len());
for (i, threads) in deadlocks.iter().enumerate() {
Expand Down
6 changes: 5 additions & 1 deletion src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ use std::{
io::Result,
task::{Context, Poll},
};
use tokio::net::{TcpListener, TcpStream, UnixListener, UnixStream};
use tokio::net::{TcpListener, TcpStream};
#[cfg(unix)]
use tokio::net::{UnixListener, UnixStream};

macro_rules! impl_stream {
($name:ident : $listener:ty => $stream:ty) => {
Expand All @@ -24,4 +26,6 @@ macro_rules! impl_stream {
}

impl_stream!(TcpListenerStream: TcpListener => TcpStream);

#[cfg(unix)]
impl_stream!(UnixListenerStream: UnixListener => UnixStream);
1 change: 0 additions & 1 deletion src/web/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use std::{
sync::Arc,
time::{Duration, Instant},
};
#[cfg(unix)]
use tokio::{
self,
io::{AsyncRead, AsyncWrite},
Expand Down

0 comments on commit 9325d9b

Please sign in to comment.