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

This commit is contained in:
Tatsuhiro Tsujikawa 2015-03-05 00:09:26 +09:00
parent 690a1622aa
commit 8accf3898a
8 changed files with 18 additions and 0 deletions

View File

@ -54,6 +54,8 @@ const std::string &request::method() const { return impl_->method(); }
const header_map &request::header() const { return impl_->header(); }
void request::resume() const { impl_->resume(); }
request_impl &request::impl() const { return *impl_; }
} // namespace client

View File

@ -72,6 +72,8 @@ read_cb::result_type request_impl::call_on_read(uint8_t *buf, std::size_t len,
return 0;
}
void request_impl::resume() { strm_->resume(); }
void request_impl::header(header_map h) { header_ = std::move(h); }
header_map &request_impl::header() { return header_; }

View File

@ -58,6 +58,8 @@ public:
read_cb::result_type call_on_read(uint8_t *buf, std::size_t len,
uint32_t *data_flags);
void resume();
void header(header_map h);
header_map &header();
const header_map &header() const;

View File

@ -327,6 +327,11 @@ void session_impl::cancel(stream &strm, uint32_t error_code) {
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) {
auto it = streams_.find(stream_id);
if (it == std::end(streams_)) {

View File

@ -54,6 +54,7 @@ public:
const error_cb &on_error() const;
void cancel(stream &strm, uint32_t error_code);
void resume(stream &strm);
std::unique_ptr<stream> create_stream();
std::unique_ptr<stream> pop_stream(int32_t stream_id);

View File

@ -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::resume() { sess_->resume(*this); }
void stream::stream_id(int32_t stream_id) { stream_id_ = stream_id; }
int32_t stream::stream_id() const { return stream_id_; }

View File

@ -45,6 +45,7 @@ public:
stream &operator=(const stream &) = delete;
void cancel(uint32_t error_code);
void resume();
void stream_id(int32_t stream_id);
int32_t stream_id() const;

View File

@ -74,6 +74,9 @@ public:
void cancel(uint32_t error_code = NGHTTP2_INTERNAL_ERROR) const;
// Resumes deferred uploading.
void resume() const;
const std::string &method() const;
const uri_ref &uri() const;