TaskPool updates
This commit is contained in:
@@ -6,10 +6,10 @@ use std::io::net::ip::Ipv4Addr;
|
|||||||
static PHRASE: &'static [u8] = b"Hello World!";
|
static PHRASE: &'static [u8] = b"Hello World!";
|
||||||
|
|
||||||
fn hyper_handle(mut incoming: hyper::server::Incoming) {
|
fn hyper_handle(mut incoming: hyper::server::Incoming) {
|
||||||
let mut pool = TaskPool::new(100, || { proc(_) { } });
|
let mut pool = TaskPool::new(100);
|
||||||
|
|
||||||
for conn in incoming {
|
for conn in incoming {
|
||||||
pool.execute(proc(_) {
|
pool.execute(proc() {
|
||||||
let (_, res) = conn.open().unwrap();
|
let (_, res) = conn.open().unwrap();
|
||||||
let mut res = res.start().unwrap();
|
let mut res = res.start().unwrap();
|
||||||
res.write(PHRASE).unwrap();
|
res.write(PHRASE).unwrap();
|
||||||
@@ -21,4 +21,3 @@ fn hyper_handle(mut incoming: hyper::server::Incoming) {
|
|||||||
fn main() {
|
fn main() {
|
||||||
hyper::Server::http(Ipv4Addr(127, 0, 0, 1), 3000).listen(hyper_handle).unwrap();
|
hyper::Server::http(Ipv4Addr(127, 0, 0, 1), 3000).listen(hyper_handle).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user