Rename FrontendAddr as UpstreamAddr

This commit is contained in:
Tatsuhiro Tsujikawa 2016-02-07 17:51:53 +09:00
parent b540aa34d0
commit 6d49110a33
12 changed files with 21 additions and 21 deletions

View File

@ -430,7 +430,7 @@ struct InheritedAddr {
};
namespace {
int create_unix_domain_server_socket(FrontendAddr &faddr,
int create_unix_domain_server_socket(UpstreamAddr &faddr,
std::vector<InheritedAddr> &iaddrs) {
auto found = std::find_if(
std::begin(iaddrs), std::end(iaddrs), [&faddr](const InheritedAddr &ia) {
@ -512,7 +512,7 @@ int create_unix_domain_server_socket(FrontendAddr &faddr,
} // namespace
namespace {
int create_tcp_server_socket(FrontendAddr &faddr,
int create_tcp_server_socket(UpstreamAddr &faddr,
std::vector<InheritedAddr> &iaddrs) {
int fd = -1;
int rv;
@ -2007,7 +2007,7 @@ void process_options(
auto &downstreamconf = mod_config()->conn.downstream;
if (listenerconf.addrs.empty()) {
FrontendAddr addr{};
UpstreamAddr addr{};
addr.host = "*";
addr.port = 3000;
addr.family = AF_INET;

View File

@ -45,7 +45,7 @@ void acceptcb(struct ev_loop *loop, ev_io *w, int revent) {
}
} // namespace
AcceptHandler::AcceptHandler(const FrontendAddr *faddr, ConnectionHandler *h)
AcceptHandler::AcceptHandler(const UpstreamAddr *faddr, ConnectionHandler *h)
: conn_hnr_(h), faddr_(faddr) {
ev_io_init(&wev_, acceptcb, faddr_->fd, EV_READ);
wev_.data = this;

View File

@ -32,11 +32,11 @@
namespace shrpx {
class ConnectionHandler;
struct FrontendAddr;
struct UpstreamAddr;
class AcceptHandler {
public:
AcceptHandler(const FrontendAddr *faddr, ConnectionHandler *h);
AcceptHandler(const UpstreamAddr *faddr, ConnectionHandler *h);
~AcceptHandler();
void accept_connection();
void enable();
@ -46,7 +46,7 @@ public:
private:
ev_io wev_;
ConnectionHandler *conn_hnr_;
const FrontendAddr *faddr_;
const UpstreamAddr *faddr_;
};
} // namespace shrpx

View File

@ -378,7 +378,7 @@ int ClientHandler::upstream_http1_connhd_read() {
ClientHandler::ClientHandler(Worker *worker, int fd, SSL *ssl,
const char *ipaddr, const char *port, int family,
const FrontendAddr *faddr)
const UpstreamAddr *faddr)
: conn_(worker->get_loop(), fd, ssl, worker->get_mcpool(),
get_config()->conn.upstream.timeout.write,
get_config()->conn.upstream.timeout.read,

View File

@ -53,7 +53,7 @@ struct WorkerStat;
class ClientHandler {
public:
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();
int noop();
@ -158,7 +158,7 @@ private:
std::function<int(ClientHandler &)> read_, write_;
std::function<int(ClientHandler &)> on_read_, on_write_;
// Address of frontend listening socket
const FrontendAddr *faddr_;
const UpstreamAddr *faddr_;
Worker *worker_;
// The number of bytes of HTTP/2 client connection header to read
size_t left_connhd_len_;

View File

@ -1460,7 +1460,7 @@ int parse_config(const char *opt, const char *optarg,
case SHRPX_OPTID_FRONTEND: {
auto &listenerconf = mod_config()->conn.listener;
FrontendAddr addr{};
UpstreamAddr addr{};
addr.fd = -1;
if (util::istarts_with(optarg, SHRPX_UNIX_PATH_PREFIX)) {

View File

@ -252,7 +252,7 @@ struct AltSvc {
uint16_t port;
};
struct FrontendAddr {
struct UpstreamAddr {
// The frontend address (e.g., FQDN, hostname, IP address). If
// |host_unix| is true, this is UNIX domain socket path.
ImmutableString host;
@ -500,7 +500,7 @@ struct ConnectionConfig {
ev_tstamp sleep;
} timeout;
// address of frontend acceptors
std::vector<FrontendAddr> addrs;
std::vector<UpstreamAddr> addrs;
int backlog;
// TCP fastopen. If this is positive, it is passed to
// setsockopt() along with TCP_FASTOPEN.

View File

@ -298,7 +298,7 @@ void ConnectionHandler::graceful_shutdown_worker() {
}
int ConnectionHandler::handle_connection(int fd, sockaddr *addr, int addrlen,
const FrontendAddr *faddr) {
const UpstreamAddr *faddr) {
if (LOG_ENABLED(INFO)) {
LLOG(INFO, this) << "Accepted connection. fd=" << fd;
}

View File

@ -58,7 +58,7 @@ class Worker;
struct WorkerStat;
struct TicketKeys;
class MemcachedDispatcher;
struct FrontendAddr;
struct UpstreamAddr;
struct OCSPUpdateContext {
// ocsp response buffer
@ -81,7 +81,7 @@ public:
ConnectionHandler(struct ev_loop *loop);
~ConnectionHandler();
int handle_connection(int fd, sockaddr *addr, int addrlen,
const FrontendAddr *faddr);
const UpstreamAddr *faddr);
// Creates Worker object for single threaded configuration.
int create_single_worker();
// Creates |num| Worker objects for multi threaded configuration.

View File

@ -779,7 +779,7 @@ SSL *create_ssl(SSL_CTX *ssl_ctx) {
}
ClientHandler *accept_connection(Worker *worker, int fd, sockaddr *addr,
int addrlen, const FrontendAddr *faddr) {
int addrlen, const UpstreamAddr *faddr) {
char host[NI_MAXHOST];
char service[NI_MAXSERV];
int rv;

View File

@ -45,7 +45,7 @@ class ClientHandler;
class Worker;
class DownstreamConnectionPool;
struct DownstreamAddr;
struct FrontendAddr;
struct UpstreamAddr;
namespace ssl {
@ -77,7 +77,7 @@ SSL_CTX *create_ssl_client_context(
);
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
// Config::downstream_addrs. We only consider first downstream since

View File

@ -53,7 +53,7 @@ namespace shrpx {
class Http2Session;
class ConnectBlocker;
class MemcachedDispatcher;
struct FrontendAddr;
struct UpstreamAddr;
#ifdef HAVE_MRUBY
namespace mruby {
@ -96,7 +96,7 @@ struct WorkerEvent {
sockaddr_union client_addr;
size_t client_addrlen;
int client_fd;
const FrontendAddr *faddr;
const UpstreamAddr *faddr;
};
std::shared_ptr<TicketKeys> ticket_keys;
};