Rename FrontendAddr as UpstreamAddr
This commit is contained in:
parent
b540aa34d0
commit
6d49110a33
|
@ -430,7 +430,7 @@ struct InheritedAddr {
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
int create_unix_domain_server_socket(FrontendAddr &faddr,
|
int create_unix_domain_server_socket(UpstreamAddr &faddr,
|
||||||
std::vector<InheritedAddr> &iaddrs) {
|
std::vector<InheritedAddr> &iaddrs) {
|
||||||
auto found = std::find_if(
|
auto found = std::find_if(
|
||||||
std::begin(iaddrs), std::end(iaddrs), [&faddr](const InheritedAddr &ia) {
|
std::begin(iaddrs), std::end(iaddrs), [&faddr](const InheritedAddr &ia) {
|
||||||
|
@ -512,7 +512,7 @@ int create_unix_domain_server_socket(FrontendAddr &faddr,
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
int create_tcp_server_socket(FrontendAddr &faddr,
|
int create_tcp_server_socket(UpstreamAddr &faddr,
|
||||||
std::vector<InheritedAddr> &iaddrs) {
|
std::vector<InheritedAddr> &iaddrs) {
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
int rv;
|
int rv;
|
||||||
|
@ -2007,7 +2007,7 @@ void process_options(
|
||||||
auto &downstreamconf = mod_config()->conn.downstream;
|
auto &downstreamconf = mod_config()->conn.downstream;
|
||||||
|
|
||||||
if (listenerconf.addrs.empty()) {
|
if (listenerconf.addrs.empty()) {
|
||||||
FrontendAddr addr{};
|
UpstreamAddr addr{};
|
||||||
addr.host = "*";
|
addr.host = "*";
|
||||||
addr.port = 3000;
|
addr.port = 3000;
|
||||||
addr.family = AF_INET;
|
addr.family = AF_INET;
|
||||||
|
|
|
@ -45,7 +45,7 @@ void acceptcb(struct ev_loop *loop, ev_io *w, int revent) {
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
AcceptHandler::AcceptHandler(const FrontendAddr *faddr, ConnectionHandler *h)
|
AcceptHandler::AcceptHandler(const UpstreamAddr *faddr, ConnectionHandler *h)
|
||||||
: conn_hnr_(h), faddr_(faddr) {
|
: conn_hnr_(h), faddr_(faddr) {
|
||||||
ev_io_init(&wev_, acceptcb, faddr_->fd, EV_READ);
|
ev_io_init(&wev_, acceptcb, faddr_->fd, EV_READ);
|
||||||
wev_.data = this;
|
wev_.data = this;
|
||||||
|
|
|
@ -32,11 +32,11 @@
|
||||||
namespace shrpx {
|
namespace shrpx {
|
||||||
|
|
||||||
class ConnectionHandler;
|
class ConnectionHandler;
|
||||||
struct FrontendAddr;
|
struct UpstreamAddr;
|
||||||
|
|
||||||
class AcceptHandler {
|
class AcceptHandler {
|
||||||
public:
|
public:
|
||||||
AcceptHandler(const FrontendAddr *faddr, ConnectionHandler *h);
|
AcceptHandler(const UpstreamAddr *faddr, ConnectionHandler *h);
|
||||||
~AcceptHandler();
|
~AcceptHandler();
|
||||||
void accept_connection();
|
void accept_connection();
|
||||||
void enable();
|
void enable();
|
||||||
|
@ -46,7 +46,7 @@ public:
|
||||||
private:
|
private:
|
||||||
ev_io wev_;
|
ev_io wev_;
|
||||||
ConnectionHandler *conn_hnr_;
|
ConnectionHandler *conn_hnr_;
|
||||||
const FrontendAddr *faddr_;
|
const UpstreamAddr *faddr_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace shrpx
|
} // namespace shrpx
|
||||||
|
|
|
@ -378,7 +378,7 @@ int ClientHandler::upstream_http1_connhd_read() {
|
||||||
|
|
||||||
ClientHandler::ClientHandler(Worker *worker, int fd, SSL *ssl,
|
ClientHandler::ClientHandler(Worker *worker, int fd, SSL *ssl,
|
||||||
const char *ipaddr, const char *port, int family,
|
const char *ipaddr, const char *port, int family,
|
||||||
const FrontendAddr *faddr)
|
const UpstreamAddr *faddr)
|
||||||
: conn_(worker->get_loop(), fd, ssl, worker->get_mcpool(),
|
: conn_(worker->get_loop(), fd, ssl, worker->get_mcpool(),
|
||||||
get_config()->conn.upstream.timeout.write,
|
get_config()->conn.upstream.timeout.write,
|
||||||
get_config()->conn.upstream.timeout.read,
|
get_config()->conn.upstream.timeout.read,
|
||||||
|
|
|
@ -53,7 +53,7 @@ struct WorkerStat;
|
||||||
class ClientHandler {
|
class ClientHandler {
|
||||||
public:
|
public:
|
||||||
ClientHandler(Worker *worker, int fd, SSL *ssl, const char *ipaddr,
|
ClientHandler(Worker *worker, int fd, SSL *ssl, const char *ipaddr,
|
||||||
const char *port, int family, const FrontendAddr *faddr);
|
const char *port, int family, const UpstreamAddr *faddr);
|
||||||
~ClientHandler();
|
~ClientHandler();
|
||||||
|
|
||||||
int noop();
|
int noop();
|
||||||
|
@ -158,7 +158,7 @@ private:
|
||||||
std::function<int(ClientHandler &)> read_, write_;
|
std::function<int(ClientHandler &)> read_, write_;
|
||||||
std::function<int(ClientHandler &)> on_read_, on_write_;
|
std::function<int(ClientHandler &)> on_read_, on_write_;
|
||||||
// Address of frontend listening socket
|
// Address of frontend listening socket
|
||||||
const FrontendAddr *faddr_;
|
const UpstreamAddr *faddr_;
|
||||||
Worker *worker_;
|
Worker *worker_;
|
||||||
// The number of bytes of HTTP/2 client connection header to read
|
// The number of bytes of HTTP/2 client connection header to read
|
||||||
size_t left_connhd_len_;
|
size_t left_connhd_len_;
|
||||||
|
|
|
@ -1460,7 +1460,7 @@ int parse_config(const char *opt, const char *optarg,
|
||||||
case SHRPX_OPTID_FRONTEND: {
|
case SHRPX_OPTID_FRONTEND: {
|
||||||
auto &listenerconf = mod_config()->conn.listener;
|
auto &listenerconf = mod_config()->conn.listener;
|
||||||
|
|
||||||
FrontendAddr addr{};
|
UpstreamAddr addr{};
|
||||||
addr.fd = -1;
|
addr.fd = -1;
|
||||||
|
|
||||||
if (util::istarts_with(optarg, SHRPX_UNIX_PATH_PREFIX)) {
|
if (util::istarts_with(optarg, SHRPX_UNIX_PATH_PREFIX)) {
|
||||||
|
|
|
@ -252,7 +252,7 @@ struct AltSvc {
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FrontendAddr {
|
struct UpstreamAddr {
|
||||||
// The frontend address (e.g., FQDN, hostname, IP address). If
|
// The frontend address (e.g., FQDN, hostname, IP address). If
|
||||||
// |host_unix| is true, this is UNIX domain socket path.
|
// |host_unix| is true, this is UNIX domain socket path.
|
||||||
ImmutableString host;
|
ImmutableString host;
|
||||||
|
@ -500,7 +500,7 @@ struct ConnectionConfig {
|
||||||
ev_tstamp sleep;
|
ev_tstamp sleep;
|
||||||
} timeout;
|
} timeout;
|
||||||
// address of frontend acceptors
|
// address of frontend acceptors
|
||||||
std::vector<FrontendAddr> addrs;
|
std::vector<UpstreamAddr> addrs;
|
||||||
int backlog;
|
int backlog;
|
||||||
// TCP fastopen. If this is positive, it is passed to
|
// TCP fastopen. If this is positive, it is passed to
|
||||||
// setsockopt() along with TCP_FASTOPEN.
|
// setsockopt() along with TCP_FASTOPEN.
|
||||||
|
|
|
@ -298,7 +298,7 @@ void ConnectionHandler::graceful_shutdown_worker() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int ConnectionHandler::handle_connection(int fd, sockaddr *addr, int addrlen,
|
int ConnectionHandler::handle_connection(int fd, sockaddr *addr, int addrlen,
|
||||||
const FrontendAddr *faddr) {
|
const UpstreamAddr *faddr) {
|
||||||
if (LOG_ENABLED(INFO)) {
|
if (LOG_ENABLED(INFO)) {
|
||||||
LLOG(INFO, this) << "Accepted connection. fd=" << fd;
|
LLOG(INFO, this) << "Accepted connection. fd=" << fd;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ class Worker;
|
||||||
struct WorkerStat;
|
struct WorkerStat;
|
||||||
struct TicketKeys;
|
struct TicketKeys;
|
||||||
class MemcachedDispatcher;
|
class MemcachedDispatcher;
|
||||||
struct FrontendAddr;
|
struct UpstreamAddr;
|
||||||
|
|
||||||
struct OCSPUpdateContext {
|
struct OCSPUpdateContext {
|
||||||
// ocsp response buffer
|
// ocsp response buffer
|
||||||
|
@ -81,7 +81,7 @@ public:
|
||||||
ConnectionHandler(struct ev_loop *loop);
|
ConnectionHandler(struct ev_loop *loop);
|
||||||
~ConnectionHandler();
|
~ConnectionHandler();
|
||||||
int handle_connection(int fd, sockaddr *addr, int addrlen,
|
int handle_connection(int fd, sockaddr *addr, int addrlen,
|
||||||
const FrontendAddr *faddr);
|
const UpstreamAddr *faddr);
|
||||||
// Creates Worker object for single threaded configuration.
|
// Creates Worker object for single threaded configuration.
|
||||||
int create_single_worker();
|
int create_single_worker();
|
||||||
// Creates |num| Worker objects for multi threaded configuration.
|
// Creates |num| Worker objects for multi threaded configuration.
|
||||||
|
|
|
@ -779,7 +779,7 @@ SSL *create_ssl(SSL_CTX *ssl_ctx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientHandler *accept_connection(Worker *worker, int fd, sockaddr *addr,
|
ClientHandler *accept_connection(Worker *worker, int fd, sockaddr *addr,
|
||||||
int addrlen, const FrontendAddr *faddr) {
|
int addrlen, const UpstreamAddr *faddr) {
|
||||||
char host[NI_MAXHOST];
|
char host[NI_MAXHOST];
|
||||||
char service[NI_MAXSERV];
|
char service[NI_MAXSERV];
|
||||||
int rv;
|
int rv;
|
||||||
|
|
|
@ -45,7 +45,7 @@ class ClientHandler;
|
||||||
class Worker;
|
class Worker;
|
||||||
class DownstreamConnectionPool;
|
class DownstreamConnectionPool;
|
||||||
struct DownstreamAddr;
|
struct DownstreamAddr;
|
||||||
struct FrontendAddr;
|
struct UpstreamAddr;
|
||||||
|
|
||||||
namespace ssl {
|
namespace ssl {
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ SSL_CTX *create_ssl_client_context(
|
||||||
);
|
);
|
||||||
|
|
||||||
ClientHandler *accept_connection(Worker *worker, int fd, sockaddr *addr,
|
ClientHandler *accept_connection(Worker *worker, int fd, sockaddr *addr,
|
||||||
int addrlen, const FrontendAddr *faddr);
|
int addrlen, const UpstreamAddr *faddr);
|
||||||
|
|
||||||
// Check peer's certificate against first downstream address in
|
// Check peer's certificate against first downstream address in
|
||||||
// Config::downstream_addrs. We only consider first downstream since
|
// Config::downstream_addrs. We only consider first downstream since
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace shrpx {
|
||||||
class Http2Session;
|
class Http2Session;
|
||||||
class ConnectBlocker;
|
class ConnectBlocker;
|
||||||
class MemcachedDispatcher;
|
class MemcachedDispatcher;
|
||||||
struct FrontendAddr;
|
struct UpstreamAddr;
|
||||||
|
|
||||||
#ifdef HAVE_MRUBY
|
#ifdef HAVE_MRUBY
|
||||||
namespace mruby {
|
namespace mruby {
|
||||||
|
@ -96,7 +96,7 @@ struct WorkerEvent {
|
||||||
sockaddr_union client_addr;
|
sockaddr_union client_addr;
|
||||||
size_t client_addrlen;
|
size_t client_addrlen;
|
||||||
int client_fd;
|
int client_fd;
|
||||||
const FrontendAddr *faddr;
|
const UpstreamAddr *faddr;
|
||||||
};
|
};
|
||||||
std::shared_ptr<TicketKeys> ticket_keys;
|
std::shared_ptr<TicketKeys> ticket_keys;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue