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

use IntoFuture

This commit is contained in:
Nikolay Kim 2019-03-04 20:40:38 -08:00
parent 15dafeff3d
commit 2e18ca805c
4 changed files with 16 additions and 9 deletions

View File

@ -1,6 +1,6 @@
# Changes # Changes
## [0.3.1] - 2019-03-xx ## [0.3.1] - 2019-03-04
### Added ### Added

View File

@ -1,6 +1,6 @@
[package] [package]
name = "actix-server" name = "actix-server"
version = "0.3.0" version = "0.3.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.3.0" actix-service = "0.3.2"
actix-rt = "0.1.0" actix-rt = "0.1.0"
log = "0.4" log = "0.4"

View File

@ -2,7 +2,7 @@ use std::collections::HashMap;
use std::{fmt, io, net}; use std::{fmt, io, net};
use actix_service::{IntoNewService, NewService}; use actix_service::{IntoNewService, NewService};
use futures::future::{join_all, Future}; use futures::future::{join_all, Future, IntoFuture};
use log::error; use log::error;
use tokio_tcp::TcpStream; use tokio_tcp::TcpStream;
@ -220,9 +220,15 @@ where
type Future = Box<Future<Item = BoxedServerService, Error = ()>>; type Future = Box<Future<Item = BoxedServerService, Error = ()>>;
fn new_service(&self, _: &()) -> Self::Future { fn new_service(&self, _: &()) -> Self::Future {
Box::new(self.inner.new_service(&()).map_err(|_| ()).map(|s| { Box::new(
let service: BoxedServerService = Box::new(StreamService::new(s)); self.inner
service .new_service(&())
})) .into_future()
.map_err(|_| ())
.map(|s| {
let service: BoxedServerService = Box::new(StreamService::new(s));
service
}),
)
} }
} }

View File

@ -3,7 +3,7 @@ use std::time::Duration;
use actix_rt::spawn; use actix_rt::spawn;
use actix_service::{NewService, Service}; use actix_service::{NewService, Service};
use futures::future::{err, ok, FutureResult}; use futures::future::{err, ok, FutureResult, IntoFuture};
use futures::{Future, Poll}; use futures::{Future, Poll};
use log::error; use log::error;
use tokio_reactor::Handle; use tokio_reactor::Handle;
@ -129,6 +129,7 @@ where
self.inner self.inner
.create() .create()
.new_service(&()) .new_service(&())
.into_future()
.map_err(|_| ()) .map_err(|_| ())
.map(move |inner| { .map(move |inner| {
let service: BoxedServerService = Box::new(StreamService::new(inner)); let service: BoxedServerService = Box::new(StreamService::new(inner));