File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -17,4 +17,6 @@ clap = "2.32"
1717lazy_static = " 1.4"
1818ajson = " 0.2"
1919async-std = { version = " 1.5" , features = [" std" ], default-features = false }
20+
21+ [target .'cfg(not(windows))' .dependencies ]
2022rlimit = " 0.3"
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ use tokio_io_timeout::TimeoutReader;
1818
1919use async_std:: sync:: { Arc , RwLock } ;
2020use clap:: { value_t, Arg } ;
21- use rlimit;
2221use std:: collections:: HashMap ;
2322use twoway:: find_bytes;
2423extern crate ajson;
@@ -27,6 +26,9 @@ extern crate lazy_static;
2726#[ macro_use]
2827extern crate clap;
2928
29+ #[ cfg( not( windows) ) ]
30+ use rlimit;
31+
3032type HttpClient = Client < hyper:: client:: HttpConnector > ;
3133type HttpsClient = Client < HttpsConnector < hyper:: client:: HttpConnector > > ;
3234static mut DOH_ENDPOINT : & ' static str = "https://1.1.1.1/dns-query" ;
@@ -149,7 +151,10 @@ async fn main() {
149151 } ) )
150152 }
151153 } ) ;
154+
155+ #[ cfg( not( windows) ) ]
152156 set_max_rlimit_nofile ( ) ;
157+
153158 let server = Server :: bind ( & SocketAddr :: from ( (
154159 [ 127 , 0 , 0 , 1 ] ,
155160 value_t ! ( matches, "port" , u16 ) . unwrap ( ) ,
@@ -373,6 +378,7 @@ where
373378 }
374379}
375380
381+ #[ cfg( not( windows) ) ]
376382fn set_max_rlimit_nofile ( ) {
377383 if rlimit:: Resource :: NOFILE
378384 . set ( rlimit:: RLIM_INFINITY , rlimit:: RLIM_INFINITY )
You can’t perform that action at this time.
0 commit comments