From 58a5d493b7d82e9680bc7c4e1cc39fb3e3c58b96 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Wed, 24 Jan 2018 20:12:49 -0800 Subject: [PATCH] re-eanble write backpressure for h1 connections --- CHANGES.md | 6 ++++++ src/context.rs | 6 +++--- src/server/h1writer.rs | 1 - src/ws/context.rs | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b88cec9f..e7812472 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/src/context.rs b/src/context.rs index 5187dd0b..76be616c 100644 --- a/src/context.rs +++ b/src/context.rs @@ -18,7 +18,7 @@ use httprequest::HttpRequest; pub trait ActorHttpContext: 'static { fn disconnected(&mut self); - fn poll(&mut self) -> Poll>, Error>; + fn poll(&mut self) -> Poll>, Error>; } #[derive(Debug)] @@ -40,7 +40,7 @@ impl Frame { pub struct HttpContext where A: Actor>, { inner: ContextImpl, - stream: Option>, + stream: Option>, request: HttpRequest, disconnected: bool, } @@ -201,7 +201,7 @@ impl ActorHttpContext for HttpContext where A: Actor, self.stop(); } - fn poll(&mut self) -> Poll>, Error> { + fn poll(&mut self) -> Poll>, Error> { let ctx: &mut HttpContext = unsafe { std::mem::transmute(self as &mut HttpContext) }; diff --git a/src/server/h1writer.rs b/src/server/h1writer.rs index e423f875..09f1b45d 100644 --- a/src/server/h1writer.rs +++ b/src/server/h1writer.rs @@ -179,7 +179,6 @@ impl Writer for H1Writer { 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()) diff --git a/src/ws/context.rs b/src/ws/context.rs index 77d8a8ae..74988674 100644 --- a/src/ws/context.rs +++ b/src/ws/context.rs @@ -23,7 +23,7 @@ use ws::proto::{OpCode, CloseCode}; pub struct WebsocketContext where A: Actor>, { inner: ContextImpl, - stream: Option>, + stream: Option>, request: HttpRequest, disconnected: bool, } @@ -226,7 +226,7 @@ impl ActorHttpContext for WebsocketContext where A: Actor Poll>, Error> { + fn poll(&mut self) -> Poll>, Error> { let ctx: &mut WebsocketContext = unsafe { mem::transmute(self as &mut WebsocketContext) };