Commit 924fef1f authored by Andreas Pohl's avatar Andreas Pohl

libnghttp2_asio: Added io_service accessors

To allow the asio wrapper to work with boost.fiber it is required
to access the underlying io_service objects.
parent 4bcc14fc
......@@ -92,6 +92,10 @@ boost::asio::io_service &io_service_pool::get_io_service() {
return io_service;
}
std::vector<std::shared_ptr<boost::asio::io_service>> &io_service_pool::get_io_services() {
return io_services_;
}
} // namespace asio_http2
} // namespace nghttp2
......@@ -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.
std::vector<std::shared_ptr<boost::asio::io_service>> &get_io_services();
private:
/// The pool of io_services.
std::vector<std::shared_ptr<boost::asio::io_service>> io_services_;
......
......@@ -169,6 +169,10 @@ void server::stop() { io_service_pool_.stop(); }
void server::join() { io_service_pool_.join(); }
std::vector<std::shared_ptr<boost::asio::io_service>> &server::get_io_services() {
return io_service_pool_.get_io_services();
}
} // namespace server
} // namespace asio_http2
} // namespace nghttp2
......@@ -73,6 +73,9 @@ public:
void join();
void stop();
/// Get access to all io_service objects.
std::vector<std::shared_ptr<boost::asio::io_service>> &get_io_services();
private:
/// Initiate an asynchronous accept operation.
void start_accept(tcp::acceptor &acceptor, serve_mux &mux);
......
......@@ -77,6 +77,10 @@ void http2::stop() { impl_->stop(); }
void http2::join() { return impl_->join(); }
std::vector<std::shared_ptr<boost::asio::io_service>> &http2::get_io_services() {
return impl_->get_io_services();
}
} // namespace server
} // namespace asio_http2
......
......@@ -59,6 +59,10 @@ void http2_impl::stop() { return server_->stop(); }
void http2_impl::join() { return server_->join(); }
std::vector<std::shared_ptr<boost::asio::io_service>> &http2_impl::get_io_services() {
return server_->get_io_services();
}
} // namespace server
} // namespace asio_http2
......
......@@ -50,6 +50,7 @@ public:
bool handle(std::string pattern, request_cb cb);
void stop();
void join();
std::vector<std::shared_ptr<boost::asio::io_service>> &get_io_services();
private:
std::unique_ptr<server> server_;
......
......@@ -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.
std::vector<std::shared_ptr<boost::asio::io_service>> &get_io_services();
private:
std::unique_ptr<http2_impl> impl_;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment