LCOV - code coverage report
Current view: top level - http/client - executor_client.cpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 100.0 % 9 9
Test Date: 2026-11-10 10:38:07 Functions: 100.0 % 4 4

            Line data    Source code
       1              : #include "executor_client.hpp"
       2              : #include <boost/asio/this_coro.hpp>
       3              : #include <stdexcept>
       4              : 
       5              : namespace thinger::http {
       6              : 
       7          204 : executor_client::executor_client(boost::asio::io_context& io_context) : io_context_(io_context) {
       8              :     // Nothing runs the io_context for the client: a pending idle timer would hold the
       9              :     // connection (and the io_context) until it expired
      10          204 :     pool_.use_idle_timers(false);
      11          204 :     max_idle_connections_per_host(0);
      12          204 : }
      13              : 
      14          369 : executor_client::~executor_client() {
      15          204 :     clear_connections();
      16          369 : }
      17              : 
      18           60 : awaitable<std::unique_ptr<executor_client>> executor_client::for_current_coroutine() {
      19              :     auto* io_context = asio::io_context_of(co_await boost::asio::this_coro::executor);
      20              :     if (!io_context) {
      21              :         throw std::logic_error("executor_client: the coroutine does not run on an io_context, "
      22              :                                "nor on a strand of one");
      23              :     }
      24              :     co_return std::make_unique<executor_client>(*io_context);
      25          120 : }
      26              : 
      27              : } // namespace thinger::http
        

Generated by: LCOV version 2.0-1