libnghttp2_asio: Add request::closed() to indicate that stream has been closed

This commit is contained in:
Tatsuhiro Tsujikawa 2014-09-25 00:15:52 +09:00
parent fd07f5e142
commit c1be28684a
3 changed files with 14 additions and 0 deletions

View File

@ -82,6 +82,11 @@ bool request::pushed() const
return impl_->pushed();
}
bool request::closed() const
{
return impl_->closed();
}
void request::on_data(data_cb cb)
{
return impl_->on_data(std::move(cb));
@ -225,6 +230,11 @@ void request_impl::pushed(bool f)
pushed_ = f;
}
bool request_impl::closed() const
{
return handler_.expired() || stream_.expired();
}
void request_impl::on_data(data_cb cb)
{
on_data_cb_ = std::move(cb);

View File

@ -60,6 +60,7 @@ public:
std::vector<header> headers = {});
bool pushed() const;
bool closed() const;
void on_data(data_cb cb);
void on_end(void_cb cb);

View File

@ -101,6 +101,9 @@ public:
// Returns true if this is pushed request.
bool pushed() const;
// Returns true if stream has been closed.
bool closed() const;
// Application must not call this directly.
request_impl& impl();
private: