Commit 8accf389 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

asio: Add client::request::resume() member function

parent 690a1622
...@@ -54,6 +54,8 @@ const std::string &request::method() const { return impl_->method(); } ...@@ -54,6 +54,8 @@ const std::string &request::method() const { return impl_->method(); }
const header_map &request::header() const { return impl_->header(); } const header_map &request::header() const { return impl_->header(); }
void request::resume() const { impl_->resume(); }
request_impl &request::impl() const { return *impl_; } request_impl &request::impl() const { return *impl_; }
} // namespace client } // namespace client
......
...@@ -72,6 +72,8 @@ read_cb::result_type request_impl::call_on_read(uint8_t *buf, std::size_t len, ...@@ -72,6 +72,8 @@ read_cb::result_type request_impl::call_on_read(uint8_t *buf, std::size_t len,
return 0; return 0;
} }
void request_impl::resume() { strm_->resume(); }
void request_impl::header(header_map h) { header_ = std::move(h); } void request_impl::header(header_map h) { header_ = std::move(h); }
header_map &request_impl::header() { return header_; } header_map &request_impl::header() { return header_; }
......
...@@ -58,6 +58,8 @@ public: ...@@ -58,6 +58,8 @@ public:
read_cb::result_type call_on_read(uint8_t *buf, std::size_t len, read_cb::result_type call_on_read(uint8_t *buf, std::size_t len,
uint32_t *data_flags); uint32_t *data_flags);
void resume();
void header(header_map h); void header(header_map h);
header_map &header(); header_map &header();
const header_map &header() const; const header_map &header() const;
......
...@@ -327,6 +327,11 @@ void session_impl::cancel(stream &strm, uint32_t error_code) { ...@@ -327,6 +327,11 @@ void session_impl::cancel(stream &strm, uint32_t error_code) {
signal_write(); signal_write();
} }
void session_impl::resume(stream &strm) {
nghttp2_session_resume_data(session_, strm.stream_id());
signal_write();
}
stream *session_impl::find_stream(int32_t stream_id) { stream *session_impl::find_stream(int32_t stream_id) {
auto it = streams_.find(stream_id); auto it = streams_.find(stream_id);
if (it == std::end(streams_)) { if (it == std::end(streams_)) {
......
...@@ -54,6 +54,7 @@ public: ...@@ -54,6 +54,7 @@ public:
const error_cb &on_error() const; const error_cb &on_error() const;
void cancel(stream &strm, uint32_t error_code); void cancel(stream &strm, uint32_t error_code);
void resume(stream &strm);
std::unique_ptr<stream> create_stream(); std::unique_ptr<stream> create_stream();
std::unique_ptr<stream> pop_stream(int32_t stream_id); std::unique_ptr<stream> pop_stream(int32_t stream_id);
......
...@@ -38,6 +38,8 @@ stream::stream(session_impl *sess) : sess_(sess), stream_id_(0) { ...@@ -38,6 +38,8 @@ stream::stream(session_impl *sess) : sess_(sess), stream_id_(0) {
void stream::cancel(uint32_t error_code) { sess_->cancel(*this, error_code); } void stream::cancel(uint32_t error_code) { sess_->cancel(*this, error_code); }
void stream::resume() { sess_->resume(*this); }
void stream::stream_id(int32_t stream_id) { stream_id_ = stream_id; } void stream::stream_id(int32_t stream_id) { stream_id_ = stream_id; }
int32_t stream::stream_id() const { return stream_id_; } int32_t stream::stream_id() const { return stream_id_; }
......
...@@ -45,6 +45,7 @@ public: ...@@ -45,6 +45,7 @@ public:
stream &operator=(const stream &) = delete; stream &operator=(const stream &) = delete;
void cancel(uint32_t error_code); void cancel(uint32_t error_code);
void resume();
void stream_id(int32_t stream_id); void stream_id(int32_t stream_id);
int32_t stream_id() const; int32_t stream_id() const;
......
...@@ -74,6 +74,9 @@ public: ...@@ -74,6 +74,9 @@ public:
void cancel(uint32_t error_code = NGHTTP2_INTERNAL_ERROR) const; void cancel(uint32_t error_code = NGHTTP2_INTERNAL_ERROR) const;
// Resumes deferred uploading.
void resume() const;
const std::string &method() const; const std::string &method() const;
const uri_ref &uri() const; const uri_ref &uri() const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment