LCOV - code coverage report
Current view: top level - http/common - http_frame.cpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 85.0 % 20 17
Test Date: 2026-11-10 10:38:07 Functions: 85.7 % 7 6

            Line data    Source code
       1              : #include "../../util/logger.hpp"
       2              : #include "http_frame.hpp"
       3              : #include <utility>
       4              : 
       5              : namespace thinger::http {
       6              : 
       7       584694 :     http_frame::~http_frame() {
       8              :         // dropped without being written (e.g. its connection is gone)
       9       584694 :         notify_written(false);
      10       584694 :     }
      11              : 
      12        16746 :     void http_frame::set_last_frame(bool last_frame) {
      13        16746 :         last_frame_ = last_frame;
      14        16746 :     }
      15              : 
      16        39948 :     bool http_frame::end_stream() {
      17        39948 :         return last_frame_;
      18              :     }
      19              : 
      20        15239 :     void http_frame::on_written(written_callback callback) {
      21        15239 :         on_written_ = std::move(callback);
      22        15239 :     }
      23              : 
      24       623667 :     void http_frame::notify_written(bool written) {
      25       623667 :         if (!on_written_) return;
      26        15239 :         auto callback = std::exchange(on_written_, nullptr);
      27              :         try {
      28        15239 :             callback(written);
      29            0 :         } catch (const std::exception& e) {
      30            0 :             LOG_ERROR("frame written callback failed: {}", e.what());
      31            0 :         }
      32        15239 :     }
      33              : 
      34        15708 :     void http_frame::log(const char*, const body_logging&) const {}
      35              : 
      36              : }
        

Generated by: LCOV version 2.0-1