nghttpx: Make sure each quic frontend endpoint has a unique address
This commit is contained in:
parent
0d35e8e15e
commit
d88eadff13
|
@ -683,12 +683,29 @@ uint32_t Worker::compute_sk_index() const {
|
||||||
# endif // HAVE_LIBBPF
|
# endif // HAVE_LIBBPF
|
||||||
|
|
||||||
int Worker::setup_quic_server_socket() {
|
int Worker::setup_quic_server_socket() {
|
||||||
|
size_t n = 0;
|
||||||
|
|
||||||
for (auto &addr : quic_upstream_addrs_) {
|
for (auto &addr : quic_upstream_addrs_) {
|
||||||
assert(!addr.host_unix);
|
assert(!addr.host_unix);
|
||||||
if (create_quic_server_socket(addr) != 0) {
|
if (create_quic_server_socket(addr) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure that each endpoint has a unique address.
|
||||||
|
for (size_t i = 0; i < n; ++i) {
|
||||||
|
const auto &a = quic_upstream_addrs_[i];
|
||||||
|
|
||||||
|
if (addr.hostport == a.hostport) {
|
||||||
|
LOG(FATAL)
|
||||||
|
<< "QUIC frontend endpoint must be unique: a duplicate found for "
|
||||||
|
<< addr.hostport;
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
++n;
|
||||||
|
|
||||||
quic_listeners_.emplace_back(std::make_unique<QUICListener>(&addr, this));
|
quic_listeners_.emplace_back(std::make_unique<QUICListener>(&addr, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue