nghttpx: Avoid copy
This commit is contained in:
parent
2a504224de
commit
d837887af6
|
@ -131,7 +131,7 @@ int APIDownstreamConnection::end_upload_data() {
|
||||||
config.conn.downstream = std::make_shared<DownstreamConfig>();
|
config.conn.downstream = std::make_shared<DownstreamConfig>();
|
||||||
const auto &downstreamconf = config.conn.downstream;
|
const auto &downstreamconf = config.conn.downstream;
|
||||||
|
|
||||||
auto src = get_config()->conn.downstream;
|
auto &src = get_config()->conn.downstream;
|
||||||
|
|
||||||
downstreamconf->timeout = src->timeout;
|
downstreamconf->timeout = src->timeout;
|
||||||
downstreamconf->connections_per_host = src->connections_per_host;
|
downstreamconf->connections_per_host = src->connections_per_host;
|
||||||
|
|
|
@ -510,8 +510,8 @@ bool Downstream::request_buf_full() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dconn_) {
|
if (dconn_) {
|
||||||
auto downstreamconf = worker->get_downstream_config();
|
auto &downstreamconf = *worker->get_downstream_config();
|
||||||
return request_buf_.rleft() >= downstreamconf->request_buffer_size;
|
return request_buf_.rleft() >= downstreamconf.request_buffer_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -604,9 +604,9 @@ bool Downstream::response_buf_full() {
|
||||||
if (dconn_) {
|
if (dconn_) {
|
||||||
auto handler = upstream_->get_client_handler();
|
auto handler = upstream_->get_client_handler();
|
||||||
auto worker = handler->get_worker();
|
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;
|
return false;
|
||||||
|
|
|
@ -857,13 +857,13 @@ nghttp2_session_callbacks *create_http2_upstream_callbacks() {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
size_t downstream_queue_size(Worker *worker) {
|
size_t downstream_queue_size(Worker *worker) {
|
||||||
auto downstreamconf = worker->get_downstream_config();
|
auto &downstreamconf = *worker->get_downstream_config();
|
||||||
|
|
||||||
if (get_config()->http2_proxy) {
|
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
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -514,13 +514,13 @@ uint32_t infer_upstream_rst_stream_status_code(uint32_t downstream_error_code) {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
size_t downstream_queue_size(Worker *worker) {
|
size_t downstream_queue_size(Worker *worker) {
|
||||||
auto downstreamconf = worker->get_downstream_config();
|
auto &downstreamconf = *worker->get_downstream_config();
|
||||||
|
|
||||||
if (get_config()->http2_proxy) {
|
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
|
} // namespace
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue