This commit is contained in:
Peter Eisenlohr 2022-03-29 23:21:29 +09:00 committed by GitHub
commit a3f20457e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 0 deletions

View File

@ -209,6 +209,15 @@ const std::vector<int> server::ports() const {
return ports;
}
const std::vector<boost::asio::ip::tcp::endpoint> server::endpoints() const {
std::vector<boost::asio::ip::tcp::endpoint> ports;
ports.reserve(acceptors_.size());
for (const auto &acceptor : acceptors_) {
ports.emplace_back(acceptor.local_endpoint());
}
return ports;
}
} // namespace server
} // namespace asio_http2
} // namespace nghttp2

View File

@ -81,6 +81,8 @@ public:
/// Returns a vector with all the acceptors ports in use.
const std::vector<int> ports() const;
/// Returns a vector with all the acceptors endpoints.
const std::vector<boost::asio::ip::tcp::endpoint> endpoints() const;
private:
/// Initiate an asynchronous accept operation.

View File

@ -92,6 +92,8 @@ http2::io_services() const {
std::vector<int> http2::ports() const { return impl_->ports(); }
std::vector<boost::asio::ip::tcp::endpoint> http2::endpoints() const { return impl_->endpoints(); }
} // namespace server
} // namespace asio_http2

View File

@ -80,6 +80,8 @@ http2_impl::io_services() const {
std::vector<int> http2_impl::ports() const { return server_->ports(); }
std::vector<boost::asio::ip::tcp::endpoint> http2_impl::endpoints() const { return server_->endpoints(); }
} // namespace server
} // namespace asio_http2

View File

@ -55,6 +55,7 @@ public:
const std::vector<std::shared_ptr<boost::asio::io_service>> &
io_services() const;
std::vector<int> ports() const;
std::vector<boost::asio::ip::tcp::endpoint> endpoints() const;
private:
std::unique_ptr<server> server_;

View File

@ -217,6 +217,9 @@ public:
// Returns a vector with the ports in use
std::vector<int> ports() const;
// Returns a vector of the endpoints in use
std::vector<boost::asio::ip::tcp::endpoint> endpoints() const;
private:
std::unique_ptr<http2_impl> impl_;
};