From 122fcd6881f78cad9d2951b597201c6e50098ce8 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sun, 29 Oct 2017 20:51:06 -0700 Subject: [PATCH] stop http actor on write_eof --- CHANGES.md | 2 ++ src/context.rs | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 88f4ffc25..f83e7b5bd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,6 +15,8 @@ * Re-use `BinaryBody` for `Frame::Payload` +* Stop http actor on `write_eof` + * Fix disconnection handling. diff --git a/src/context.rs b/src/context.rs index 798a480fb..81fcc4a65 100644 --- a/src/context.rs +++ b/src/context.rs @@ -50,7 +50,6 @@ impl ActorContext for HttpContext where A: Actor + Route if self.state == ActorState::Running { self.state = ActorState::Stopping; } - self.write_eof(); } /// Terminate actor execution @@ -134,9 +133,10 @@ impl HttpContext where A: Actor + Route { self.stream.push_back(Frame::Payload(Some(data.into()))) } - /// Indicate end of streamimng payload + /// Indicate end of streamimng payload. Also this method calls `Self::close`. pub fn write_eof(&mut self) { - self.stream.push_back(Frame::Payload(None)) + self.stream.push_back(Frame::Payload(None)); + self.stop(); } /// Returns drain future