1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-27 17:52:56 +01:00

stop http actor on write_eof

This commit is contained in:
Nikolay Kim 2017-10-29 20:51:06 -07:00
parent dec4140733
commit 122fcd6881
2 changed files with 5 additions and 3 deletions

View File

@ -15,6 +15,8 @@
* Re-use `BinaryBody` for `Frame::Payload`
* Stop http actor on `write_eof`
* Fix disconnection handling.

View File

@ -50,7 +50,6 @@ impl<A> ActorContext for HttpContext<A> where A: Actor<Context=Self> + Route
if self.state == ActorState::Running {
self.state = ActorState::Stopping;
}
self.write_eof();
}
/// Terminate actor execution
@ -134,9 +133,10 @@ impl<A> HttpContext<A> where A: Actor<Context=Self> + 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