From 9671eaa850a5e90b5ee264714d180ce5e7cb4e84 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 4 Mar 2015 02:18:55 +0900 Subject: [PATCH] asio: Set stream pointer to request and response in stream ctor --- src/asio_client_session_impl.cc | 7 +------ src/asio_client_stream.cc | 5 ++++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/asio_client_session_impl.cc b/src/asio_client_session_impl.cc index c0773270..5282e8cc 100644 --- a/src/asio_client_session_impl.cc +++ b/src/asio_client_session_impl.cc @@ -355,12 +355,7 @@ stream *session_impl::create_push_stream(int32_t stream_id) { } std::unique_ptr session_impl::create_stream() { - auto strm = make_unique(this); - - auto &req = strm->request().impl(); - req.stream(strm.get()); - - return strm; + return make_unique(this); } const request *session_impl::submit(boost::system::error_code &ec, diff --git a/src/asio_client_stream.cc b/src/asio_client_stream.cc index 60f5572b..e0ca9c41 100644 --- a/src/asio_client_stream.cc +++ b/src/asio_client_stream.cc @@ -32,7 +32,10 @@ namespace nghttp2 { namespace asio_http2 { 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); }