1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-24 04:52:58 +01:00

Drop service response

This commit is contained in:
Nikolay Kim 2019-02-09 21:39:17 -08:00
parent a53f06a1a4
commit e354c6df92
3 changed files with 20 additions and 13 deletions

View File

@ -1,8 +1,15 @@
# Changes # Changes
## [0.2.1] - 2019-02-09
### Changes
* Drop service response
## [0.2.0] - 2019-02-01 ## [0.2.0] - 2019-02-01
## Changes ### Changes
* Migrate to actix-service 0.2 * Migrate to actix-service 0.2
@ -11,14 +18,14 @@
## [0.1.3] - 2018-12-21 ## [0.1.3] - 2018-12-21
## Fixed ### Fixed
* Fix max concurrent connections handling * Fix max concurrent connections handling
## [0.1.2] - 2018-12-12 ## [0.1.2] - 2018-12-12
## Changed ### Changed
* rename ServiceConfig::rt() to ServiceConfig::apply() * rename ServiceConfig::rt() to ServiceConfig::apply()

View File

@ -1,6 +1,6 @@
[package] [package]
name = "actix-server" name = "actix-server"
version = "0.2.0" version = "0.2.1"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"] authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Actix server - General purpose tcp server" description = "Actix server - General purpose tcp server"
keywords = ["network", "framework", "async", "futures"] keywords = ["network", "framework", "async", "futures"]
@ -33,7 +33,7 @@ ssl = ["openssl", "tokio-openssl"]
rust-tls = ["rustls", "tokio-rustls", "webpki", "webpki-roots"] rust-tls = ["rustls", "tokio-rustls", "webpki", "webpki-roots"]
[dependencies] [dependencies]
actix-service = "0.2.0" actix-service = "0.2.1"
actix-rt = "0.1.0" actix-rt = "0.1.0"
log = "0.4" log = "0.4"

View File

@ -23,13 +23,13 @@ pub enum ServerMessage {
} }
pub trait StreamServiceFactory: Send + Clone + 'static { pub trait StreamServiceFactory: Send + Clone + 'static {
type NewService: NewService<Request = TcpStream, Response = ()>; type NewService: NewService<Request = TcpStream>;
fn create(&self) -> Self::NewService; fn create(&self) -> Self::NewService;
} }
pub trait ServiceFactory: Send + Clone + 'static { pub trait ServiceFactory: Send + Clone + 'static {
type NewService: NewService<Request = ServerMessage, Response = ()>; type NewService: NewService<Request = ServerMessage>;
fn create(&self) -> Self::NewService; fn create(&self) -> Self::NewService;
} }
@ -63,7 +63,7 @@ impl<T> StreamService<T> {
impl<T> Service for StreamService<T> impl<T> Service for StreamService<T>
where where
T: Service<Request = TcpStream, Response = ()>, T: Service<Request = TcpStream>,
T::Future: 'static, T::Future: 'static,
T::Error: 'static, T::Error: 'static,
{ {
@ -86,7 +86,7 @@ where
if let Ok(stream) = stream { if let Ok(stream) = stream {
spawn(self.service.call(stream).then(move |res| { spawn(self.service.call(stream).then(move |res| {
drop(guard); drop(guard);
res.map_err(|_| ()) res.map_err(|_| ()).map(|_| ())
})); }));
ok(()) ok(())
} else { } else {
@ -110,7 +110,7 @@ impl<T> ServerService<T> {
impl<T> Service for ServerService<T> impl<T> Service for ServerService<T>
where where
T: Service<Request = ServerMessage, Response = ()>, T: Service<Request = ServerMessage>,
T::Future: 'static, T::Future: 'static,
T::Error: 'static, T::Error: 'static,
{ {
@ -126,7 +126,7 @@ where
fn call(&mut self, (guard, req): (Option<CounterGuard>, ServerMessage)) -> Self::Future { fn call(&mut self, (guard, req): (Option<CounterGuard>, ServerMessage)) -> Self::Future {
spawn(self.service.call(req).then(move |res| { spawn(self.service.call(req).then(move |res| {
drop(guard); drop(guard);
res.map_err(|_| ()) res.map_err(|_| ()).map(|_| ())
})); }));
ok(()) ok(())
} }
@ -241,7 +241,7 @@ impl InternalServiceFactory for Box<InternalServiceFactory> {
impl<F, T> ServiceFactory for F impl<F, T> ServiceFactory for F
where where
F: Fn() -> T + Send + Clone + 'static, F: Fn() -> T + Send + Clone + 'static,
T: NewService<Request = ServerMessage, Response = ()>, T: NewService<Request = ServerMessage>,
{ {
type NewService = T; type NewService = T;
@ -253,7 +253,7 @@ where
impl<F, T> StreamServiceFactory for F impl<F, T> StreamServiceFactory for F
where where
F: Fn() -> T + Send + Clone + 'static, F: Fn() -> T + Send + Clone + 'static,
T: NewService<Request = TcpStream, Response = ()>, T: NewService<Request = TcpStream>,
{ {
type NewService = T; type NewService = T;