LCOV - code coverage report
Current view: top level - asio/sockets - socket.cpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 88.9 % 18 16
Test Date: 2026-02-20 15:38:22 Functions: 66.7 % 6 4

            Line data    Source code
       1              : #include <iostream>
       2              : #include "socket.hpp"
       3              : 
       4              : namespace thinger::asio {
       5              : 
       6              :     std::atomic<unsigned long> socket::connections(0);
       7              : 
       8       769291 :     socket::socket(const std::string& context, boost::asio::io_context& io_context)
       9       769291 :         : context_(context), io_context_(io_context) {
      10       769291 :         ++connections;
      11       769291 :         std::lock_guard<std::mutex> lock(mutex_);
      12       769291 :         context_count[context_]++;
      13       769291 :     }
      14              : 
      15       769291 :     socket::~socket() {
      16       769291 :         --connections;
      17       769291 :         std::lock_guard<std::mutex> lock(mutex_);
      18       769291 :         if (--context_count[context_] == 0) {
      19         5031 :             context_count.erase(context_);
      20              :         }
      21       769291 :     }
      22              : 
      23         4867 :     boost::asio::io_context& socket::get_io_context() const {
      24         4867 :         return io_context_;
      25              :     }
      26              : 
      27         1547 :     bool socket::requires_handshake() const {
      28         1547 :         return false;
      29              :     }
      30              : 
      31            0 :     awaitable<boost::system::error_code> socket::handshake(const std::string& host) {
      32              :         co_return boost::system::error_code{};
      33            0 :     }
      34              : 
      35              :     std::map<std::string, unsigned long> socket::context_count;
      36              :     std::mutex socket::mutex_;
      37              : }
        

Generated by: LCOV version 2.0-1