1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-09-02 01:31:57 +02:00

refactor Payload stream

This commit is contained in:
Nikolay Kim
2017-10-26 23:14:33 -07:00
parent 488fb256b4
commit fb0270e27d
9 changed files with 56 additions and 48 deletions

View File

@@ -86,7 +86,7 @@ impl<H: HttpHandler> HttpServer<TcpStream, net::SocketAddr, H> {
if let Ok(iter) = addr.to_socket_addrs() {
for addr in iter {
match TcpListener::bind(&addr, Arbiter::handle()) {
Ok(tcp) => addrs.push(tcp),
Ok(tcp) => addrs.push((addr, tcp)),
Err(e) => err = Some(e),
}
}
@@ -99,7 +99,8 @@ impl<H: HttpHandler> HttpServer<TcpStream, net::SocketAddr, H> {
}
} else {
Ok(HttpServer::create(move |ctx| {
for tcp in addrs {
for (addr, tcp) in addrs {
info!("Starting http server on {}", addr);
ctx.add_stream(tcp.incoming().map(|(t, a)| IoStream(t, a)));
}
self