1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-26 10:00:34 +00: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