shrpx_http2_upstream: Use std::unique_ptr for pre_upstream_

This commit is contained in:
Tatsuhiro Tsujikawa 2013-09-26 21:46:35 +09:00
parent 3368c8b378
commit 55b8a0b777
2 changed files with 5 additions and 5 deletions

View File

@ -161,7 +161,7 @@ int Http2Upstream::upgrade_upstream(HttpsUpstream *http)
<< nghttp2_strerror(rv); << nghttp2_strerror(rv);
return -1; return -1;
} }
pre_upstream_ = http; pre_upstream_.reset(http);
http->pop_downstream(); http->pop_downstream();
downstream->reset_upstream(this); downstream->reset_upstream(this);
add_downstream(downstream); add_downstream(downstream);
@ -405,8 +405,7 @@ nghttp2_error_code infer_upstream_rst_stream_error_code
Http2Upstream::Http2Upstream(ClientHandler *handler) Http2Upstream::Http2Upstream(ClientHandler *handler)
: handler_(handler), : handler_(handler),
session_(nullptr), session_(nullptr)
pre_upstream_(nullptr)
{ {
//handler->set_bev_cb(spdy_readcb, 0, spdy_eventcb); //handler->set_bev_cb(spdy_readcb, 0, spdy_eventcb);
handler->set_upstream_timeouts(&get_config()->spdy_upstream_read_timeout, handler->set_upstream_timeouts(&get_config()->spdy_upstream_read_timeout,
@ -457,7 +456,6 @@ Http2Upstream::Http2Upstream(ClientHandler *handler)
Http2Upstream::~Http2Upstream() Http2Upstream::~Http2Upstream()
{ {
nghttp2_session_del(session_); nghttp2_session_del(session_);
delete pre_upstream_;
} }
int Http2Upstream::on_read() int Http2Upstream::on_read()

View File

@ -27,6 +27,8 @@
#include "shrpx.h" #include "shrpx.h"
#include <memory>
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>
#include "shrpx_upstream.h" #include "shrpx_upstream.h"
@ -79,7 +81,7 @@ private:
bool flow_control_; bool flow_control_;
int32_t initial_window_size_; int32_t initial_window_size_;
DownstreamQueue downstream_queue_; DownstreamQueue downstream_queue_;
HttpsUpstream *pre_upstream_; std::unique_ptr<HttpsUpstream> pre_upstream_;
}; };
} // namespace shrpx } // namespace shrpx