nghttpx: Avoid copy

This commit is contained in:
Tatsuhiro Tsujikawa 2016-06-04 16:23:50 +09:00
parent 2a504224de
commit d837887af6
4 changed files with 11 additions and 11 deletions

View File

@ -131,7 +131,7 @@ int APIDownstreamConnection::end_upload_data() {
config.conn.downstream = std::make_shared<DownstreamConfig>();
const auto &downstreamconf = config.conn.downstream;
auto src = get_config()->conn.downstream;
auto &src = get_config()->conn.downstream;
downstreamconf->timeout = src->timeout;
downstreamconf->connections_per_host = src->connections_per_host;

View File

@ -510,8 +510,8 @@ bool Downstream::request_buf_full() {
}
if (dconn_) {
auto downstreamconf = worker->get_downstream_config();
return request_buf_.rleft() >= downstreamconf->request_buffer_size;
auto &downstreamconf = *worker->get_downstream_config();
return request_buf_.rleft() >= downstreamconf.request_buffer_size;
}
return false;
@ -604,9 +604,9 @@ bool Downstream::response_buf_full() {
if (dconn_) {
auto handler = upstream_->get_client_handler();
auto worker = handler->get_worker();
auto downstreamconf = worker->get_downstream_config();
auto &downstreamconf = *worker->get_downstream_config();
return response_buf_.rleft() >= downstreamconf->response_buffer_size;
return response_buf_.rleft() >= downstreamconf.response_buffer_size;
}
return false;

View File

@ -857,13 +857,13 @@ nghttp2_session_callbacks *create_http2_upstream_callbacks() {
namespace {
size_t downstream_queue_size(Worker *worker) {
auto downstreamconf = worker->get_downstream_config();
auto &downstreamconf = *worker->get_downstream_config();
if (get_config()->http2_proxy) {
return downstreamconf->connections_per_host;
return downstreamconf.connections_per_host;
}
return downstreamconf->connections_per_frontend;
return downstreamconf.connections_per_frontend;
}
} // namespace

View File

@ -514,13 +514,13 @@ uint32_t infer_upstream_rst_stream_status_code(uint32_t downstream_error_code) {
namespace {
size_t downstream_queue_size(Worker *worker) {
auto downstreamconf = worker->get_downstream_config();
auto &downstreamconf = *worker->get_downstream_config();
if (get_config()->http2_proxy) {
return downstreamconf->connections_per_host;
return downstreamconf.connections_per_host;
}
return downstreamconf->connections_per_frontend;
return downstreamconf.connections_per_frontend;
}
} // namespace