Merge branch 'puscas-port_in_use'
This commit is contained in:
commit
eb6792533d
|
@ -200,6 +200,15 @@ server::io_services() const {
|
|||
return io_service_pool_.io_services();
|
||||
}
|
||||
|
||||
const std::vector<int> server::ports() const {
|
||||
auto ports = std::vector<int>(acceptors_.size());
|
||||
auto index = 0;
|
||||
for (const auto &acceptor : acceptors_) {
|
||||
ports[index++] = acceptor.local_endpoint().port();
|
||||
}
|
||||
return ports;
|
||||
}
|
||||
|
||||
} // namespace server
|
||||
} // namespace asio_http2
|
||||
} // namespace nghttp2
|
||||
|
|
|
@ -79,6 +79,9 @@ public:
|
|||
const std::vector<std::shared_ptr<boost::asio::io_service>> &
|
||||
io_services() const;
|
||||
|
||||
/// Returns a vector with all the acceptors ports in use.
|
||||
const std::vector<int> ports() const;
|
||||
|
||||
private:
|
||||
/// Initiate an asynchronous accept operation.
|
||||
void start_accept(tcp::acceptor &acceptor, serve_mux &mux);
|
||||
|
|
|
@ -90,6 +90,8 @@ http2::io_services() const {
|
|||
return impl_->io_services();
|
||||
}
|
||||
|
||||
std::vector<int> http2::ports() const { return impl_->ports(); }
|
||||
|
||||
} // namespace server
|
||||
|
||||
} // namespace asio_http2
|
||||
|
|
|
@ -78,6 +78,8 @@ http2_impl::io_services() const {
|
|||
return server_->io_services();
|
||||
}
|
||||
|
||||
std::vector<int> http2_impl::ports() const { return server_->ports(); }
|
||||
|
||||
} // namespace server
|
||||
|
||||
} // namespace asio_http2
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
void join();
|
||||
const std::vector<std::shared_ptr<boost::asio::io_service>> &
|
||||
io_services() const;
|
||||
std::vector<int> ports() const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<server> server_;
|
||||
|
|
|
@ -214,6 +214,9 @@ public:
|
|||
const std::vector<std::shared_ptr<boost::asio::io_service>> &
|
||||
io_services() const;
|
||||
|
||||
// Returns a vector with the ports in use
|
||||
std::vector<int> ports() const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<http2_impl> impl_;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue