libnghttp2_asio: Add request::closed() to indicate that stream has been closed
This commit is contained in:
parent
fd07f5e142
commit
c1be28684a
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue