LCOV - code coverage report
Current view: top level - boost/beast2/server - route_handler_asio.hpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 27.3 % 11 3
Test Date: 2025-12-20 18:15:08 Functions: 16.7 % 6 1

            Line data    Source code
       1              : //
       2              : // Copyright (c) 2025 Vinnie Falco (vinnie dot falco at gmail dot com)
       3              : //
       4              : // Distributed under the Boost Software License, Version 1.0. (See accompanying
       5              : // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       6              : //
       7              : // Official repository: https://github.com/cppalliance/beast2
       8              : //
       9              : 
      10              : #ifndef BOOST_BEAST2_SERVER_ROUTE_HANDLER_ASIO_HPP
      11              : #define BOOST_BEAST2_SERVER_ROUTE_HANDLER_ASIO_HPP
      12              : 
      13              : #include <boost/beast2/detail/config.hpp>
      14              : #include <boost/http_proto/server/route_handler.hpp>
      15              : #include <boost/asio/post.hpp>
      16              : #include <type_traits>
      17              : 
      18              : namespace boost {
      19              : namespace beast2 {
      20              : 
      21              : /** Route parameters object for Asio HTTP route handlers
      22              : */
      23              : template<class AsyncStream>
      24              : class asio_route_params
      25              :     : public http_proto::route_params
      26              : {
      27              : public:
      28              :     using stream_type = typename std::decay<AsyncStream>::type;
      29              : 
      30              :     AsyncStream stream;
      31              : 
      32              :     template<class... Args>
      33              :     explicit
      34            1 :     asio_route_params(
      35              :         Args&&... args)
      36            1 :         : stream(std::forward<Args>(args)...)
      37              :     {
      38            1 :     }
      39              : 
      40              : private:
      41              :     void do_post() override;
      42              : };
      43              : 
      44              : //-----------------------------------------------
      45              : 
      46              : template<class AsyncStream>
      47              : void
      48            0 : asio_route_params<AsyncStream>::
      49              : do_post()
      50              : {
      51            0 :     asio::post(
      52            0 :         stream.get_executor(),
      53            0 :         [&]
      54              :         {
      55            0 :             if(task_->invoke())
      56            0 :                 return;
      57            0 :             do_post();
      58              :         });
      59            0 : }
      60              : 
      61              : } // beast2
      62              : } // boost
      63              : 
      64              : #endif
        

Generated by: LCOV version 2.1