mirror of
https://github.com/fafhrd91/actix-net
synced 2025-02-22 19:53:17 +01:00
back port bug fixes
This commit is contained in:
parent
c62567f85f
commit
298727dcbd
@ -1,5 +1,14 @@
|
|||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
|
## [0.2.5] - 2018-12-12
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* Fix back-pressure for concurrent ssl handshakes
|
||||||
|
|
||||||
|
* Drop completed future for .then and .and_then combinators
|
||||||
|
|
||||||
|
|
||||||
## [0.2.4] - 2018-11-21
|
## [0.2.4] - 2018-11-21
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "actix-net"
|
name = "actix-net"
|
||||||
version = "0.2.4"
|
version = "0.2.5"
|
||||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||||
description = "Actix net - framework for the compisible network services for Rust (experimental)"
|
description = "Actix net - framework for the compisible network services for Rust (experimental)"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@ -9,6 +9,7 @@ use futures::task::AtomicTask;
|
|||||||
/// Counter could be cloned, total ncount is shared across all clones.
|
/// Counter could be cloned, total ncount is shared across all clones.
|
||||||
pub struct Counter(Rc<CounterInner>);
|
pub struct Counter(Rc<CounterInner>);
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
struct CounterInner {
|
struct CounterInner {
|
||||||
count: Cell<usize>,
|
count: Cell<usize>,
|
||||||
capacity: usize,
|
capacity: usize,
|
||||||
@ -40,6 +41,7 @@ impl Counter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct CounterGuard(Rc<CounterInner>);
|
pub struct CounterGuard(Rc<CounterInner>);
|
||||||
|
|
||||||
impl CounterGuard {
|
impl CounterGuard {
|
||||||
@ -57,11 +59,7 @@ impl Drop for CounterGuard {
|
|||||||
|
|
||||||
impl CounterInner {
|
impl CounterInner {
|
||||||
fn inc(&self) {
|
fn inc(&self) {
|
||||||
let num = self.count.get() + 1;
|
self.count.set(self.count.get() + 1);
|
||||||
self.count.set(num);
|
|
||||||
if num == self.capacity {
|
|
||||||
self.task.register();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dec(&self) {
|
fn dec(&self) {
|
||||||
@ -73,6 +71,10 @@ impl CounterInner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn available(&self) -> bool {
|
fn available(&self) -> bool {
|
||||||
self.count.get() < self.capacity
|
let avail = self.count.get() < self.capacity;
|
||||||
|
if !avail {
|
||||||
|
self.task.register();
|
||||||
|
}
|
||||||
|
avail
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ where
|
|||||||
{
|
{
|
||||||
b: Cell<B>,
|
b: Cell<B>,
|
||||||
fut_b: Option<B::Future>,
|
fut_b: Option<B::Future>,
|
||||||
fut_a: A::Future,
|
fut_a: Option<A::Future>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A, B> AndThenFuture<A, B>
|
impl<A, B> AndThenFuture<A, B>
|
||||||
@ -71,10 +71,10 @@ where
|
|||||||
A: Service,
|
A: Service,
|
||||||
B: Service<Request = A::Response, Error = A::Error>,
|
B: Service<Request = A::Response, Error = A::Error>,
|
||||||
{
|
{
|
||||||
fn new(fut_a: A::Future, b: Cell<B>) -> Self {
|
fn new(a: A::Future, b: Cell<B>) -> Self {
|
||||||
AndThenFuture {
|
AndThenFuture {
|
||||||
b,
|
b,
|
||||||
fut_a,
|
fut_a: Some(a),
|
||||||
fut_b: None,
|
fut_b: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,8 +94,9 @@ where
|
|||||||
return fut.poll();
|
return fut.poll();
|
||||||
}
|
}
|
||||||
|
|
||||||
match self.fut_a.poll() {
|
match self.fut_a.as_mut().expect("actix-net bug").poll() {
|
||||||
Ok(Async::Ready(resp)) => {
|
Ok(Async::Ready(resp)) => {
|
||||||
|
let _ = self.fut_a.take();
|
||||||
self.fut_b = Some(self.b.borrow_mut().call(resp));
|
self.fut_b = Some(self.b.borrow_mut().call(resp));
|
||||||
self.poll()
|
self.poll()
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ where
|
|||||||
{
|
{
|
||||||
b: Cell<B>,
|
b: Cell<B>,
|
||||||
fut_b: Option<B::Future>,
|
fut_b: Option<B::Future>,
|
||||||
fut_a: A::Future,
|
fut_a: Option<A::Future>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A, B> ThenFuture<A, B>
|
impl<A, B> ThenFuture<A, B>
|
||||||
@ -71,10 +71,10 @@ where
|
|||||||
A: Service,
|
A: Service,
|
||||||
B: Service<Request = Result<A::Response, A::Error>>,
|
B: Service<Request = Result<A::Response, A::Error>>,
|
||||||
{
|
{
|
||||||
fn new(fut_a: A::Future, b: Cell<B>) -> Self {
|
fn new(a: A::Future, b: Cell<B>) -> Self {
|
||||||
ThenFuture {
|
ThenFuture {
|
||||||
b,
|
b,
|
||||||
fut_a,
|
fut_a: Some(a),
|
||||||
fut_b: None,
|
fut_b: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -93,12 +93,14 @@ where
|
|||||||
return fut.poll();
|
return fut.poll();
|
||||||
}
|
}
|
||||||
|
|
||||||
match self.fut_a.poll() {
|
match self.fut_a.as_mut().expect("actix-net bug").poll() {
|
||||||
Ok(Async::Ready(resp)) => {
|
Ok(Async::Ready(resp)) => {
|
||||||
|
let _ = self.fut_a.take();
|
||||||
self.fut_b = Some(self.b.borrow_mut().call(Ok(resp)));
|
self.fut_b = Some(self.b.borrow_mut().call(Ok(resp)));
|
||||||
self.poll()
|
self.poll()
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
let _ = self.fut_a.take();
|
||||||
self.fut_b = Some(self.b.borrow_mut().call(Err(err)));
|
self.fut_b = Some(self.b.borrow_mut().call(Err(err)));
|
||||||
self.poll()
|
self.poll()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user