Commit 5b58db39 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Fix failure case when comparing backend address set

parent 7c954c1e
...@@ -70,14 +70,26 @@ bool match_shared_downstream_addr( ...@@ -70,14 +70,26 @@ bool match_shared_downstream_addr(
return false; return false;
} }
auto used = std::vector<bool>(lhs->addrs.size());
for (auto &a : lhs->addrs) { for (auto &a : lhs->addrs) {
if (std::find_if(std::begin(rhs->addrs), std::end(rhs->addrs), size_t i;
[&a](const DownstreamAddr &b) { for (i = 0; i < rhs->addrs.size(); ++i) {
return a.host == b.host && a.port == b.port && if (used[i]) {
a.host_unix == b.host_unix; continue;
}) == std::end(rhs->addrs)) { }
auto &b = rhs->addrs[i];
if (a.host == b.host && a.port == b.port && a.host_unix == b.host_unix) {
break;
}
}
if (i == rhs->addrs.size()) {
return false; return false;
} }
used[i] = true;
} }
return true; return true;
......
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