diff --git a/src/shrpx.cc b/src/shrpx.cc index 5ccbc17e..5ba58fb3 100644 --- a/src/shrpx.cc +++ b/src/shrpx.cc @@ -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 &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 &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; diff --git a/src/shrpx_accept_handler.cc b/src/shrpx_accept_handler.cc index 1b091d3d..7cfa2d9f 100644 --- a/src/shrpx_accept_handler.cc +++ b/src/shrpx_accept_handler.cc @@ -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; diff --git a/src/shrpx_accept_handler.h b/src/shrpx_accept_handler.h index 2505db27..853e9a2b 100644 --- a/src/shrpx_accept_handler.h +++ b/src/shrpx_accept_handler.h @@ -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 diff --git a/src/shrpx_client_handler.cc b/src/shrpx_client_handler.cc index 30f2fc4e..4b12d1c1 100644 --- a/src/shrpx_client_handler.cc +++ b/src/shrpx_client_handler.cc @@ -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, diff --git a/src/shrpx_client_handler.h b/src/shrpx_client_handler.h index 027c4d43..4830e93e 100644 --- a/src/shrpx_client_handler.h +++ b/src/shrpx_client_handler.h @@ -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 read_, write_; std::function 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_; diff --git a/src/shrpx_config.cc b/src/shrpx_config.cc index ed61378f..102319e5 100644 --- a/src/shrpx_config.cc +++ b/src/shrpx_config.cc @@ -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)) { diff --git a/src/shrpx_config.h b/src/shrpx_config.h index 614e7a25..2d511fda 100644 --- a/src/shrpx_config.h +++ b/src/shrpx_config.h @@ -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 addrs; + std::vector addrs; int backlog; // TCP fastopen. If this is positive, it is passed to // setsockopt() along with TCP_FASTOPEN. diff --git a/src/shrpx_connection_handler.cc b/src/shrpx_connection_handler.cc index 950986f2..6f2b585d 100644 --- a/src/shrpx_connection_handler.cc +++ b/src/shrpx_connection_handler.cc @@ -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; } diff --git a/src/shrpx_connection_handler.h b/src/shrpx_connection_handler.h index 71feb711..81d872f5 100644 --- a/src/shrpx_connection_handler.h +++ b/src/shrpx_connection_handler.h @@ -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. diff --git a/src/shrpx_ssl.cc b/src/shrpx_ssl.cc index 115fbf91..88b3e95d 100644 --- a/src/shrpx_ssl.cc +++ b/src/shrpx_ssl.cc @@ -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; diff --git a/src/shrpx_ssl.h b/src/shrpx_ssl.h index c5e65fbe..41c41f00 100644 --- a/src/shrpx_ssl.h +++ b/src/shrpx_ssl.h @@ -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 diff --git a/src/shrpx_worker.h b/src/shrpx_worker.h index 5158a55f..3939b4c8 100644 --- a/src/shrpx_worker.h +++ b/src/shrpx_worker.h @@ -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 ticket_keys; };