1
1
//! HTTP Server
2
2
use std:: io:: { BufReader , BufWriter , Write } ;
3
3
use std:: marker:: PhantomData ;
4
- use std:: net:: { IpAddr , SocketAddr } ;
4
+ use std:: net:: { Ipv4Addr , SocketAddr } ;
5
5
use std:: path:: Path ;
6
6
use std:: thread:: { self , JoinGuard } ;
7
7
@@ -76,7 +76,7 @@ impl<'a, H: Handler + 'static> Server<'a, H, HttpListener> {
76
76
77
77
impl < ' a , H : Handler + ' static > Server < ' a , H , HttpListener > {
78
78
/// Binds to a socket, and starts handling connections using a task pool.
79
- pub fn listen_threads ( self , ip : IpAddr , port : u16 , threads : usize ) -> HttpResult < Listening > {
79
+ pub fn listen_threads ( self , ip : Ipv4Addr , port : u16 , threads : usize ) -> HttpResult < Listening > {
80
80
let addr = & ( ip, port) ;
81
81
let listener = try!( match self . ssl {
82
82
Some ( ( cert, key) ) => HttpListener :: https ( addr, cert, key) ,
@@ -86,7 +86,7 @@ impl<'a, H: Handler + 'static> Server<'a, H, HttpListener> {
86
86
}
87
87
88
88
/// Binds to a socket and starts handling connections.
89
- pub fn listen ( self , ip : IpAddr , port : u16 ) -> HttpResult < Listening > {
89
+ pub fn listen ( self , ip : Ipv4Addr , port : u16 ) -> HttpResult < Listening > {
90
90
self . listen_threads ( ip, port, num_cpus:: get ( ) * 5 / 4 )
91
91
}
92
92
}
0 commit comments