| @@ -1,4 +1,4 @@ | ||||
| #![feature(core, collections, io, net, | ||||
| #![feature(core, collections, io, | ||||
|            std_misc, box_syntax, unsafe_destructor)] | ||||
| #![deny(missing_docs)] | ||||
| #![cfg_attr(test, deny(warnings))] | ||||
|   | ||||
| @@ -215,8 +215,8 @@ impl NetworkListener for HttpListener { | ||||
|     #[inline] | ||||
|     fn socket_addr(&mut self) -> io::Result<SocketAddr> { | ||||
|         match *self { | ||||
|             HttpListener::Http(ref mut tcp) => tcp.socket_addr(), | ||||
|             HttpListener::Https(ref mut tcp, _) => tcp.socket_addr(), | ||||
|             HttpListener::Http(ref mut tcp) => tcp.local_addr(), | ||||
|             HttpListener::Https(ref mut tcp, _) => tcp.local_addr(), | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| //! HTTP Server | ||||
| use std::io::{BufReader, BufWriter, Write}; | ||||
| use std::marker::PhantomData; | ||||
| use std::net::{IpAddr, SocketAddr}; | ||||
| use std::net::{Ipv4Addr, SocketAddr}; | ||||
| use std::path::Path; | ||||
| use std::thread::{self, JoinGuard}; | ||||
|  | ||||
| @@ -76,7 +76,7 @@ impl<'a, H: Handler + 'static> Server<'a, H, HttpListener> { | ||||
|  | ||||
| impl<'a, H: Handler + 'static> Server<'a, H, HttpListener> { | ||||
|     /// Binds to a socket, and starts handling connections using a task pool. | ||||
|     pub fn listen_threads(self, ip: IpAddr, port: u16, threads: usize) -> HttpResult<Listening> { | ||||
|     pub fn listen_threads(self, ip: Ipv4Addr, port: u16, threads: usize) -> HttpResult<Listening> { | ||||
|         let addr = &(ip, port); | ||||
|         let listener = try!(match self.ssl { | ||||
|             Some((cert, key)) => HttpListener::https(addr, cert, key), | ||||
| @@ -86,7 +86,7 @@ impl<'a, H: Handler + 'static> Server<'a, H, HttpListener> { | ||||
|     } | ||||
|  | ||||
|     /// Binds to a socket and starts handling connections. | ||||
|     pub fn listen(self, ip: IpAddr, port: u16) -> HttpResult<Listening> { | ||||
|     pub fn listen(self, ip: Ipv4Addr, port: u16) -> HttpResult<Listening> { | ||||
|         self.listen_threads(ip, port, num_cpus::get() * 5 / 4) | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user