asio: Set stream pointer to request and response in stream ctor

This commit is contained in:
Tatsuhiro Tsujikawa 2015-03-04 02:18:55 +09:00
parent 062b42918c
commit 9671eaa850
2 changed files with 5 additions and 7 deletions

View File

@ -355,12 +355,7 @@ stream *session_impl::create_push_stream(int32_t stream_id) {
} }
std::unique_ptr<stream> session_impl::create_stream() { std::unique_ptr<stream> session_impl::create_stream() {
auto strm = make_unique<stream>(this); return make_unique<stream>(this);
auto &req = strm->request().impl();
req.stream(strm.get());
return strm;
} }
const request *session_impl::submit(boost::system::error_code &ec, const request *session_impl::submit(boost::system::error_code &ec,

View File

@ -32,7 +32,10 @@ namespace nghttp2 {
namespace asio_http2 { namespace asio_http2 {
namespace client { namespace client {
stream::stream(session_impl *sess) : sess_(sess), stream_id_(0) {} stream::stream(session_impl *sess) : sess_(sess), stream_id_(0)
{
request_.impl().stream(this);
}
void stream::cancel() { sess_->cancel(*this); } void stream::cancel() { sess_->cancel(*this); }