feat(server): keep-alive!

Internals have been shuffled around such that Request and Reponse are
now given only a mutable reference to the stream, instead of being
allowed to consume it. This allows the server to re-use the streams if
keep-alive is true.

A task pool is used, and the number of the threads can currently be
adjusted by using the `listen_threads()` method on Server.

[breaking-change]
This commit is contained in:
Sean McArthur
2014-11-12 15:17:41 -08:00
parent 1f2f93cfea
commit 3cd9b10bcb
12 changed files with 167 additions and 232 deletions

View File

@@ -66,10 +66,10 @@
//!
//! #### Handler + Server
//!
//! A Handler in Hyper just accepts an Iterator of `(Request, Response)` pairs and
//! does whatever it wants with it. This gives Handlers maximum flexibility to decide
//! on concurrency strategy and exactly how they want to distribute the work of
//! dealing with `Request` and `Response.`
//! A `Handler` in Hyper accepts a `Request` and `Response`. This is where
//! user-code can handle each connection. The server accepts connections in a
//! task pool with a customizable number of threads, and passes the Request /
//! Response to the handler.
//!
//! #### Request
//!
@@ -133,7 +133,6 @@ extern crate openssl;
#[phase(plugin,link)] extern crate log;
#[cfg(test)] extern crate test;
extern crate "unsafe-any" as uany;
extern crate "move-acceptor" as macceptor;
extern crate typeable;
extern crate cookie;
@@ -252,7 +251,4 @@ impl FromError<IoError> for HttpError {
fn _assert_send<T: Send>() {
_assert_send::<client::Request<net::Fresh>>();
_assert_send::<client::Response>();
_assert_send::<server::Request>();
_assert_send::<server::Response<net::Fresh>>();
}