provide access to servers local acceptor endpoints
This commit is contained in:
parent
fa7a916ef3
commit
55fce39cbe
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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_;
|
||||
|
|
|
@ -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_;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue