nghttp: next_weight_idx is enough to be an local variable
This commit is contained in:
parent
3c1c2c4aad
commit
af5b354685
|
@ -96,7 +96,6 @@ Config::Config()
|
||||||
: header_table_size(-1),
|
: header_table_size(-1),
|
||||||
min_header_table_size(std::numeric_limits<uint32_t>::max()),
|
min_header_table_size(std::numeric_limits<uint32_t>::max()),
|
||||||
padding(0),
|
padding(0),
|
||||||
next_weight_idx(0),
|
|
||||||
max_concurrent_streams(100),
|
max_concurrent_streams(100),
|
||||||
peer_max_concurrent_streams(100),
|
peer_max_concurrent_streams(100),
|
||||||
multiply(1),
|
multiply(1),
|
||||||
|
@ -2484,16 +2483,19 @@ int run(char **uris, int n) {
|
||||||
}
|
}
|
||||||
std::vector<std::tuple<std::string, nghttp2_data_provider *, int64_t,
|
std::vector<std::tuple<std::string, nghttp2_data_provider *, int64_t,
|
||||||
int32_t>> requests;
|
int32_t>> requests;
|
||||||
|
|
||||||
|
size_t next_weight_idx = 0;
|
||||||
|
|
||||||
for (int i = 0; i < n; ++i) {
|
for (int i = 0; i < n; ++i) {
|
||||||
http_parser_url u{};
|
http_parser_url u{};
|
||||||
auto uri = strip_fragment(uris[i]);
|
auto uri = strip_fragment(uris[i]);
|
||||||
if (http_parser_parse_url(uri.c_str(), uri.size(), 0, &u) != 0) {
|
if (http_parser_parse_url(uri.c_str(), uri.size(), 0, &u) != 0) {
|
||||||
++config.next_weight_idx;
|
++next_weight_idx;
|
||||||
std::cerr << "[ERROR] Could not parse URI " << uri << std::endl;
|
std::cerr << "[ERROR] Could not parse URI " << uri << std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!util::has_uri_field(u, UF_SCHEMA)) {
|
if (!util::has_uri_field(u, UF_SCHEMA)) {
|
||||||
++config.next_weight_idx;
|
++next_weight_idx;
|
||||||
std::cerr << "[ERROR] URI " << uri << " does not have scheme part"
|
std::cerr << "[ERROR] URI " << uri << " does not have scheme part"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
continue;
|
continue;
|
||||||
|
@ -2516,8 +2518,7 @@ int run(char **uris, int n) {
|
||||||
prev_port = port;
|
prev_port = port;
|
||||||
}
|
}
|
||||||
requests.emplace_back(uri, data_fd == -1 ? nullptr : &data_prd,
|
requests.emplace_back(uri, data_fd == -1 ? nullptr : &data_prd,
|
||||||
data_stat.st_size,
|
data_stat.st_size, config.weight[next_weight_idx++]);
|
||||||
config.weight[config.next_weight_idx++]);
|
|
||||||
}
|
}
|
||||||
if (!requests.empty()) {
|
if (!requests.empty()) {
|
||||||
if (communicate(prev_scheme, prev_host, prev_port, std::move(requests),
|
if (communicate(prev_scheme, prev_host, prev_port, std::move(requests),
|
||||||
|
|
|
@ -73,8 +73,6 @@ struct Config {
|
||||||
int64_t header_table_size;
|
int64_t header_table_size;
|
||||||
int64_t min_header_table_size;
|
int64_t min_header_table_size;
|
||||||
size_t padding;
|
size_t padding;
|
||||||
// the next index into weight.
|
|
||||||
size_t next_weight_idx;
|
|
||||||
size_t max_concurrent_streams;
|
size_t max_concurrent_streams;
|
||||||
ssize_t peer_max_concurrent_streams;
|
ssize_t peer_max_concurrent_streams;
|
||||||
int multiply;
|
int multiply;
|
||||||
|
|
Loading…
Reference in New Issue