diff --git a/src/asio_io_service_pool.cc b/src/asio_io_service_pool.cc index ba405412..916f6d1e 100644 --- a/src/asio_io_service_pool.cc +++ b/src/asio_io_service_pool.cc @@ -92,6 +92,10 @@ boost::asio::io_service &io_service_pool::get_io_service() { return io_service; } +const std::vector> &io_service_pool::get_io_services() const { + return io_services_; +} + } // namespace asio_http2 } // namespace nghttp2 diff --git a/src/asio_io_service_pool.h b/src/asio_io_service_pool.h index 242cac8f..9c29619d 100644 --- a/src/asio_io_service_pool.h +++ b/src/asio_io_service_pool.h @@ -70,6 +70,9 @@ public: /// Get an io_service to use. boost::asio::io_service &get_io_service(); + /// Get access to all io_service objects. + const std::vector> &get_io_services() const; + private: /// The pool of io_services. std::vector> io_services_; diff --git a/src/asio_server.cc b/src/asio_server.cc index 531677f3..ff9bb3b5 100644 --- a/src/asio_server.cc +++ b/src/asio_server.cc @@ -169,6 +169,10 @@ void server::stop() { io_service_pool_.stop(); } void server::join() { io_service_pool_.join(); } +const std::vector> &server::get_io_services() const { + return io_service_pool_.get_io_services(); +} + } // namespace server } // namespace asio_http2 } // namespace nghttp2 diff --git a/src/asio_server.h b/src/asio_server.h index 7f601201..433f6530 100644 --- a/src/asio_server.h +++ b/src/asio_server.h @@ -73,6 +73,9 @@ public: void join(); void stop(); + /// Get access to all io_service objects. + const std::vector> &get_io_services() const; + private: /// Initiate an asynchronous accept operation. void start_accept(tcp::acceptor &acceptor, serve_mux &mux); diff --git a/src/asio_server_http2.cc b/src/asio_server_http2.cc index 7d162e34..ca270a25 100644 --- a/src/asio_server_http2.cc +++ b/src/asio_server_http2.cc @@ -77,6 +77,10 @@ void http2::stop() { impl_->stop(); } void http2::join() { return impl_->join(); } +const std::vector> &http2::get_io_services() const { + return impl_->get_io_services(); +} + } // namespace server } // namespace asio_http2 diff --git a/src/asio_server_http2_impl.cc b/src/asio_server_http2_impl.cc index 79994a83..62c0df29 100644 --- a/src/asio_server_http2_impl.cc +++ b/src/asio_server_http2_impl.cc @@ -59,6 +59,10 @@ void http2_impl::stop() { return server_->stop(); } void http2_impl::join() { return server_->join(); } +const std::vector> &http2_impl::get_io_services() const { + return server_->get_io_services(); +} + } // namespace server } // namespace asio_http2 diff --git a/src/asio_server_http2_impl.h b/src/asio_server_http2_impl.h index e4068694..395310bd 100644 --- a/src/asio_server_http2_impl.h +++ b/src/asio_server_http2_impl.h @@ -50,6 +50,7 @@ public: bool handle(std::string pattern, request_cb cb); void stop(); void join(); + const std::vector> &get_io_services() const; private: std::unique_ptr server_; diff --git a/src/includes/nghttp2/asio_http2_server.h b/src/includes/nghttp2/asio_http2_server.h index 1c5a71fd..8756022e 100644 --- a/src/includes/nghttp2/asio_http2_server.h +++ b/src/includes/nghttp2/asio_http2_server.h @@ -201,6 +201,9 @@ public: // Join on http2 server and wait for it to fully stop void join(); + // Get access to the io_service objects. + const std::vector> &get_io_services() const; + private: std::unique_ptr impl_; };