Commit d837887a authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Avoid copy

parent 2a504224
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment