1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-10-02 08:12:02 +00:00

re-eanble write backpressure for h1 connections

This commit is contained in:
Nikolay Kim 2018-01-24 20:12:49 -08:00
parent c5341017cd
commit 58a5d493b7
4 changed files with 11 additions and 6 deletions

View file

@ -1,5 +1,11 @@
# Changes
## 0.3.3 (2018-01-xx)
* Stop processing any events after context stop
* Re-enable write back pressure for h1 connections
## 0.3.2 (2018-01-21)
* Fix HEAD requests handling

View file

@ -18,7 +18,7 @@ use httprequest::HttpRequest;
pub trait ActorHttpContext: 'static {
fn disconnected(&mut self);
fn poll(&mut self) -> Poll<Option<SmallVec<[Frame; 2]>>, Error>;
fn poll(&mut self) -> Poll<Option<SmallVec<[Frame; 4]>>, Error>;
}
#[derive(Debug)]
@ -40,7 +40,7 @@ impl Frame {
pub struct HttpContext<A, S=()> where A: Actor<Context=HttpContext<A, S>>,
{
inner: ContextImpl<A>,
stream: Option<SmallVec<[Frame; 2]>>,
stream: Option<SmallVec<[Frame; 4]>>,
request: HttpRequest<S>,
disconnected: bool,
}
@ -201,7 +201,7 @@ impl<A, S> ActorHttpContext for HttpContext<A, S> where A: Actor<Context=Self>,
self.stop();
}
fn poll(&mut self) -> Poll<Option<SmallVec<[Frame; 2]>>, Error> {
fn poll(&mut self) -> Poll<Option<SmallVec<[Frame; 4]>>, Error> {
let ctx: &mut HttpContext<A, S> = unsafe {
std::mem::transmute(self as &mut HttpContext<A, S>)
};

View file

@ -179,7 +179,6 @@ impl<T: AsyncWrite> Writer for H1Writer<T> {
if self.flags.contains(Flags::STARTED) {
// TODO: add warning, write after EOF
self.encoder.write(payload)?;
return Ok(WriterState::Done)
} else {
// might be response to EXCEPT
self.buffer.extend_from_slice(payload.as_ref())

View file

@ -23,7 +23,7 @@ use ws::proto::{OpCode, CloseCode};
pub struct WebsocketContext<A, S=()> where A: Actor<Context=WebsocketContext<A, S>>,
{
inner: ContextImpl<A>,
stream: Option<SmallVec<[ContextFrame; 2]>>,
stream: Option<SmallVec<[ContextFrame; 4]>>,
request: HttpRequest<S>,
disconnected: bool,
}
@ -226,7 +226,7 @@ impl<A, S> ActorHttpContext for WebsocketContext<A, S> where A: Actor<Context=Se
self.stop();
}
fn poll(&mut self) -> Poll<Option<SmallVec<[ContextFrame;2]>>, Error> {
fn poll(&mut self) -> Poll<Option<SmallVec<[ContextFrame; 4]>>, Error> {
let ctx: &mut WebsocketContext<A, S> = unsafe {
mem::transmute(self as &mut WebsocketContext<A, S>)
};