1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-27 17:52:56 +01:00

set nodelay on socket #560

This commit is contained in:
Nikolay Kim 2018-11-08 16:29:43 -08:00
parent aed3933ae8
commit 7065c540e1
3 changed files with 35 additions and 14 deletions

View File

@ -2,18 +2,20 @@
## [0.7.14] - 2018-11-x ## [0.7.14] - 2018-11-x
### Added
* Add method to configure custom error handler to `Query` and `Path` extractors.
* Add method to configure `SameSite` option in `CookieIdentityPolicy`.
### Fixed ### Fixed
* Fix keep-alive timer reset * Fix keep-alive timer reset
* HttpServer now treats streaming bodies the same for HTTP/1.x protocols. #549 * HttpServer now treats streaming bodies the same for HTTP/1.x protocols. #549
* Set nodelay for socket #560
### Added
* Add method to configure custom error handler to `Query` and `Path` extractors.
* Add method to configure `SameSite` option in `CookieIdentityPolicy`.
## [0.7.13] - 2018-10-14 ## [0.7.13] - 2018-10-14

View File

@ -9,14 +9,20 @@ use super::acceptor::{
}; };
use super::error::AcceptorError; use super::error::AcceptorError;
use super::handler::IntoHttpHandler; use super::handler::IntoHttpHandler;
use super::service::HttpService; use super::service::{HttpService, StreamConfiguration};
use super::settings::{ServerSettings, ServiceConfig}; use super::settings::{ServerSettings, ServiceConfig};
use super::KeepAlive; use super::KeepAlive;
pub(crate) trait ServiceProvider { pub(crate) trait ServiceProvider {
fn register( fn register(
&self, server: Server, lst: net::TcpListener, host: String, &self,
addr: net::SocketAddr, keep_alive: KeepAlive, secure: bool, client_timeout: u64, server: Server,
lst: net::TcpListener,
host: String,
addr: net::SocketAddr,
keep_alive: KeepAlive,
secure: bool,
client_timeout: u64,
client_shutdown: u64, client_shutdown: u64,
) -> Server; ) -> Server;
} }
@ -43,8 +49,13 @@ where
} }
fn finish( fn finish(
&self, host: String, addr: net::SocketAddr, keep_alive: KeepAlive, secure: bool, &self,
client_timeout: u64, client_shutdown: u64, host: String,
addr: net::SocketAddr,
keep_alive: KeepAlive,
secure: bool,
client_timeout: u64,
client_shutdown: u64,
) -> impl ServiceFactory { ) -> impl ServiceFactory {
let factory = self.factory.clone(); let factory = self.factory.clone();
let acceptor = self.acceptor.clone(); let acceptor = self.acceptor.clone();
@ -65,6 +76,7 @@ where
acceptor.create(), acceptor.create(),
)).map_err(|_| ()) )).map_err(|_| ())
.map_init_err(|_| ()) .map_init_err(|_| ())
.and_then(StreamConfiguration::new().nodelay(true))
.and_then( .and_then(
HttpService::new(settings) HttpService::new(settings)
.map_init_err(|_| ()) .map_init_err(|_| ())
@ -76,6 +88,7 @@ where
TcpAcceptor::new(acceptor.create().map_err(AcceptorError::Service)) TcpAcceptor::new(acceptor.create().map_err(AcceptorError::Service))
.map_err(|_| ()) .map_err(|_| ())
.map_init_err(|_| ()) .map_init_err(|_| ())
.and_then(StreamConfiguration::new().nodelay(true))
.and_then( .and_then(
HttpService::new(settings) HttpService::new(settings)
.map_init_err(|_| ()) .map_init_err(|_| ())
@ -95,8 +108,14 @@ where
H: IntoHttpHandler, H: IntoHttpHandler,
{ {
fn register( fn register(
&self, server: Server, lst: net::TcpListener, host: String, &self,
addr: net::SocketAddr, keep_alive: KeepAlive, secure: bool, client_timeout: u64, server: Server,
lst: net::TcpListener,
host: String,
addr: net::SocketAddr,
keep_alive: KeepAlive,
secure: bool,
client_timeout: u64,
client_shutdown: u64, client_shutdown: u64,
) -> Server { ) -> Server {
server.listen2( server.listen2(

View File

@ -88,7 +88,7 @@ where
Ok(Async::Ready(())) Ok(Async::Ready(()))
} }
fn call(&mut self, req: Self::Request) -> Self::Future { fn call(&mut self, mut req: Self::Request) -> Self::Future {
HttpChannel::new(self.settings.clone(), req) HttpChannel::new(self.settings.clone(), req)
} }
} }