nghttpx: Add BlockAllocator to SharedDownstreamAddr
This commit is contained in:
parent
ede6104900
commit
f5285d1f5a
|
@ -198,13 +198,16 @@ void Worker::replace_downstream_config(
|
||||||
auto &dst_addr = shared_addr->addrs[j];
|
auto &dst_addr = shared_addr->addrs[j];
|
||||||
|
|
||||||
dst_addr.addr = src_addr.addr;
|
dst_addr.addr = src_addr.addr;
|
||||||
dst_addr.host = src_addr.host;
|
dst_addr.host =
|
||||||
dst_addr.hostport = src_addr.hostport;
|
make_string_ref(shared_addr->balloc, StringRef{src_addr.host});
|
||||||
|
dst_addr.hostport =
|
||||||
|
make_string_ref(shared_addr->balloc, StringRef{src_addr.hostport});
|
||||||
dst_addr.port = src_addr.port;
|
dst_addr.port = src_addr.port;
|
||||||
dst_addr.host_unix = src_addr.host_unix;
|
dst_addr.host_unix = src_addr.host_unix;
|
||||||
dst_addr.proto = src_addr.proto;
|
dst_addr.proto = src_addr.proto;
|
||||||
dst_addr.tls = src_addr.tls;
|
dst_addr.tls = src_addr.tls;
|
||||||
dst_addr.sni = src_addr.sni;
|
dst_addr.sni =
|
||||||
|
make_string_ref(shared_addr->balloc, StringRef{src_addr.sni});
|
||||||
dst_addr.fall = src_addr.fall;
|
dst_addr.fall = src_addr.fall;
|
||||||
dst_addr.rise = src_addr.rise;
|
dst_addr.rise = src_addr.rise;
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
#include "shrpx_ssl.h"
|
#include "shrpx_ssl.h"
|
||||||
#include "shrpx_live_check.h"
|
#include "shrpx_live_check.h"
|
||||||
#include "shrpx_connect_blocker.h"
|
#include "shrpx_connect_blocker.h"
|
||||||
|
#include "allocator.h"
|
||||||
|
|
||||||
using namespace nghttp2;
|
using namespace nghttp2;
|
||||||
|
|
||||||
|
@ -75,15 +76,15 @@ struct DownstreamAddr {
|
||||||
Address addr;
|
Address addr;
|
||||||
// backend address. If |host_unix| is true, this is UNIX domain
|
// backend address. If |host_unix| is true, this is UNIX domain
|
||||||
// socket path.
|
// socket path.
|
||||||
ImmutableString host;
|
StringRef host;
|
||||||
ImmutableString hostport;
|
StringRef hostport;
|
||||||
// backend port. 0 if |host_unix| is true.
|
// backend port. 0 if |host_unix| is true.
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
// true if |host| contains UNIX domain socket path.
|
// true if |host| contains UNIX domain socket path.
|
||||||
bool host_unix;
|
bool host_unix;
|
||||||
|
|
||||||
// sni field to send remote server if TLS is enabled.
|
// sni field to send remote server if TLS is enabled.
|
||||||
ImmutableString sni;
|
StringRef sni;
|
||||||
|
|
||||||
std::unique_ptr<ConnectBlocker> connect_blocker;
|
std::unique_ptr<ConnectBlocker> connect_blocker;
|
||||||
std::unique_ptr<LiveCheck> live_check;
|
std::unique_ptr<LiveCheck> live_check;
|
||||||
|
@ -128,8 +129,18 @@ struct WeightedPri {
|
||||||
|
|
||||||
struct SharedDownstreamAddr {
|
struct SharedDownstreamAddr {
|
||||||
SharedDownstreamAddr()
|
SharedDownstreamAddr()
|
||||||
: next{0}, http1_pri{}, http2_pri{}, affinity{AFFINITY_NONE} {}
|
: balloc(1024, 1024),
|
||||||
|
next{0},
|
||||||
|
http1_pri{},
|
||||||
|
http2_pri{},
|
||||||
|
affinity{AFFINITY_NONE} {}
|
||||||
|
|
||||||
|
SharedDownstreamAddr(const SharedDownstreamAddr &) = delete;
|
||||||
|
SharedDownstreamAddr(SharedDownstreamAddr &&) = delete;
|
||||||
|
SharedDownstreamAddr &operator=(const SharedDownstreamAddr &) = delete;
|
||||||
|
SharedDownstreamAddr &operator=(SharedDownstreamAddr &&) = delete;
|
||||||
|
|
||||||
|
BlockAllocator balloc;
|
||||||
std::vector<DownstreamAddr> addrs;
|
std::vector<DownstreamAddr> addrs;
|
||||||
// Bunch of session affinity hash. Only used if affinity ==
|
// Bunch of session affinity hash. Only used if affinity ==
|
||||||
// AFFINITY_IP.
|
// AFFINITY_IP.
|
||||||
|
@ -162,6 +173,11 @@ struct SharedDownstreamAddr {
|
||||||
struct DownstreamAddrGroup {
|
struct DownstreamAddrGroup {
|
||||||
DownstreamAddrGroup() : retired{false} {};
|
DownstreamAddrGroup() : retired{false} {};
|
||||||
|
|
||||||
|
DownstreamAddrGroup(const DownstreamAddrGroup &) = delete;
|
||||||
|
DownstreamAddrGroup(DownstreamAddrGroup &&) = delete;
|
||||||
|
DownstreamAddrGroup &operator=(const DownstreamAddrGroup &) = delete;
|
||||||
|
DownstreamAddrGroup &operator=(DownstreamAddrGroup &&) = delete;
|
||||||
|
|
||||||
ImmutableString pattern;
|
ImmutableString pattern;
|
||||||
std::shared_ptr<SharedDownstreamAddr> shared_addr;
|
std::shared_ptr<SharedDownstreamAddr> shared_addr;
|
||||||
// true if this group is no longer used for new request. If this is
|
// true if this group is no longer used for new request. If this is
|
||||||
|
|
Loading…
Reference in New Issue