1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-23 21:51:06 +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
## [0.3.1] - 2019-03-xx
## [0.3.1] - 2019-03-04
### Added

View File

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

View File

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