Skip to content

Commit

Permalink
Update server.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
1 parent 4e8b024 commit 88e30e7
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions proxy/src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ Server::Server()
listen_port_(Configuration::get("listen-port").as<uint16_t>()),
tls_proxy_acceptor_(io_context_),
tls_proxy_address_(
make_address(Configuration::get("tls-proxy-address").as<string>())),
tls_proxy_port_(Configuration::get("tls-proxy-port").as<uint16_t>()),
make_address(Configuration::get("tls-proxy-address").as<string>()))
stop_(false) {}

void Server::Run() { io_context_.run(); }
Expand All @@ -59,15 +58,18 @@ void Server::StartTcp() {
}

void Server::StartTls() {
auto tls_endpoint = tcp::endpoint(tls_proxy_address_, tls_proxy_port_);
tls_proxy_acceptor_.open(tls_endpoint.protocol());
tls_proxy_acceptor_.set_option(
auto& ports = Configuration::get("tls-proxy-port").as<std::vector<uint16_t>>();
for (auto port : ports) {
auto tls_endpoint = tcp::endpoint(tls_proxy_address_, tls_proxy_port_);
tls_proxy_acceptor_.open(tls_endpoint.protocol());
tls_proxy_acceptor_.set_option(
boost::asio::ip::tcp::acceptor::reuse_address(true));
tls_proxy_acceptor_.bind(tls_endpoint);
tls_proxy_acceptor_.listen();
DoAcceptTls();
LOG_INFO("Listening on " << tls_proxy_address_ << ":" << tls_proxy_port_
<< " TLS TCP");
tls_proxy_acceptor_.bind(tls_endpoint);
tls_proxy_acceptor_.listen();
DoAcceptTls();
LOG_INFO("Listening on " << tls_proxy_address_ << ":" << tls_proxy_port_
<< " TLS TCP");
}
}

void Server::DoAcceptTls() {
Expand Down

0 comments on commit 88e30e7

Please sign in to comment.