nghttpx: Set connect_blocker and live_check after shuffling addresses
This commit is contained in:
parent
9e6c0685a2
commit
40af31da4c
|
@ -275,21 +275,6 @@ void Worker::replace_downstream_config(
|
||||||
dst_addr.rise = src_addr.rise;
|
dst_addr.rise = src_addr.rise;
|
||||||
dst_addr.dns = src_addr.dns;
|
dst_addr.dns = src_addr.dns;
|
||||||
dst_addr.upgrade_scheme = src_addr.upgrade_scheme;
|
dst_addr.upgrade_scheme = src_addr.upgrade_scheme;
|
||||||
|
|
||||||
auto shared_addr_ptr = shared_addr.get();
|
|
||||||
|
|
||||||
dst_addr.connect_blocker = std::make_unique<ConnectBlocker>(
|
|
||||||
randgen_, loop_, nullptr, [shared_addr_ptr, &dst_addr]() {
|
|
||||||
if (!dst_addr.queued) {
|
|
||||||
if (!dst_addr.wg) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ensure_enqueue_addr(shared_addr_ptr->pq, dst_addr.wg, &dst_addr);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
dst_addr.live_check = std::make_unique<LiveCheck>(
|
|
||||||
loop_, cl_ssl_ctx_, this, &dst_addr, randgen_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_MRUBY
|
#ifdef HAVE_MRUBY
|
||||||
|
@ -313,6 +298,23 @@ void Worker::replace_downstream_config(
|
||||||
std::shuffle(std::begin(shared_addr->addrs), std::end(shared_addr->addrs),
|
std::shuffle(std::begin(shared_addr->addrs), std::end(shared_addr->addrs),
|
||||||
randgen_);
|
randgen_);
|
||||||
|
|
||||||
|
auto shared_addr_ptr = shared_addr.get();
|
||||||
|
|
||||||
|
for (auto &addr : shared_addr->addrs) {
|
||||||
|
addr.connect_blocker = std::make_unique<ConnectBlocker>(
|
||||||
|
randgen_, loop_, nullptr, [shared_addr_ptr, &addr]() {
|
||||||
|
if (!addr.queued) {
|
||||||
|
if (!addr.wg) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ensure_enqueue_addr(shared_addr_ptr->pq, addr.wg, &addr);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addr.live_check = std::make_unique<LiveCheck>(loop_, cl_ssl_ctx_, this,
|
||||||
|
&addr, randgen_);
|
||||||
|
}
|
||||||
|
|
||||||
size_t seq = 0;
|
size_t seq = 0;
|
||||||
for (auto &addr : shared_addr->addrs) {
|
for (auto &addr : shared_addr->addrs) {
|
||||||
addr.dconn_pool = std::make_unique<DownstreamConnectionPool>();
|
addr.dconn_pool = std::make_unique<DownstreamConnectionPool>();
|
||||||
|
|
Loading…
Reference in New Issue