diff --git a/src/asio_http2_handler.cc b/src/asio_http2_handler.cc index d6ba0e01..65d37386 100644 --- a/src/asio_http2_handler.cc +++ b/src/asio_http2_handler.cc @@ -33,6 +33,34 @@ namespace nghttp2 { namespace asio_http2 { +channel::channel() + : impl_(util::make_unique()) +{} + +void channel::post(void_cb cb) +{ + impl_->post(std::move(cb)); +} + +channel_impl& channel::impl() +{ + return *impl_; +} + +channel_impl::channel_impl() + : strand_(nullptr) +{} + +void channel_impl::post(void_cb cb) +{ + strand_->post(std::move(cb)); +} + +void channel_impl::strand(boost::asio::io_service::strand *strand) +{ + strand_ = strand; +} + namespace server { extern std::shared_ptr cached_date; @@ -402,34 +430,6 @@ std::pair response_impl::call_read return std::make_pair(0, true); } -channel::channel() - : impl_(util::make_unique()) -{} - -void channel::post(void_cb cb) -{ - impl_->post(std::move(cb)); -} - -channel_impl& channel::impl() -{ - return *impl_; -} - -channel_impl::channel_impl() - : strand_(nullptr) -{} - -void channel_impl::post(void_cb cb) -{ - strand_->post(std::move(cb)); -} - -void channel_impl::strand(boost::asio::io_service::strand *strand) -{ - strand_ = strand; -} - http2_stream::http2_stream(int32_t stream_id) : request_(std::make_shared()), response_(std::make_shared()), diff --git a/src/asio_http2_handler.h b/src/asio_http2_handler.h index cbeed227..8bfe6683 100644 --- a/src/asio_http2_handler.h +++ b/src/asio_http2_handler.h @@ -40,6 +40,16 @@ namespace nghttp2 { namespace asio_http2 { + +class channel_impl { +public: + channel_impl(); + void post(void_cb cb); + void strand(boost::asio::io_service::strand *strand); +private: + boost::asio::io_service::strand *strand_; +}; + namespace server { class http2_handler; @@ -117,15 +127,6 @@ private: bool started_; }; -class channel_impl { -public: - channel_impl(); - void post(void_cb cb); - void strand(boost::asio::io_service::strand *strand); -private: - boost::asio::io_service::strand *strand_; -}; - class http2_stream { public: http2_stream(int32_t stream_id); diff --git a/src/asio_http2_impl.cc b/src/asio_http2_impl.cc index 728b67a4..a5dd8607 100644 --- a/src/asio_http2_impl.cc +++ b/src/asio_http2_impl.cc @@ -153,6 +153,8 @@ void http2_impl::num_concurrent_tasks(size_t num_concurrent_tasks) num_concurrent_tasks_ = num_concurrent_tasks; } +} // namespace server + template std::shared_ptr> defer_shared(T&& t, F f) { @@ -206,8 +208,6 @@ std::string http_date(time_t t) return util::http_date(t); } -} // namespace server - } // namespace asio_http2 } // namespace nghttp2 diff --git a/src/includes/nghttp2/asio_http2.h b/src/includes/nghttp2/asio_http2.h index cee2da3f..aaca11da 100644 --- a/src/includes/nghttp2/asio_http2.h +++ b/src/includes/nghttp2/asio_http2.h @@ -40,11 +40,6 @@ struct header { std::string value; }; -namespace server { - -class request_impl; -class response_impl; - typedef std::function data_cb; typedef std::function void_cb; @@ -83,6 +78,11 @@ private: typedef std::function thread_cb; +namespace server { + +class request_impl; +class response_impl; + class request { public: // Application must not call this directly. @@ -212,6 +212,8 @@ private: std::unique_ptr impl_; }; +} // namespace server + // Convenient function to create function to read file denoted by // |path|. This can be passed to response::end(). read_cb file_reader(const std::string& path); @@ -233,8 +235,6 @@ std::string percent_decode(const std::string& s); // Returns HTTP date representation of current posix time |t|. std::string http_date(time_t t); -} // namespace server - } // namespace asio_http2 } // namespace nghttp2