LCOV - code coverage report
Current view: top level - source/common/network - udp_packet_writer_handler_impl.cc (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 2 11 18.2 %
Date: 2024-01-05 06:35:25 Functions: 2 3 66.7 %

          Line data    Source code
       1             : #include "source/common/network/udp_packet_writer_handler_impl.h"
       2             : 
       3             : #include "source/common/buffer/buffer_impl.h"
       4             : #include "source/common/network/utility.h"
       5             : 
       6             : namespace Envoy {
       7             : namespace Network {
       8             : 
       9          91 : UdpDefaultWriter::UdpDefaultWriter(Network::IoHandle& io_handle) : io_handle_(io_handle) {}
      10             : 
      11          91 : UdpDefaultWriter::~UdpDefaultWriter() = default;
      12             : 
      13             : Api::IoCallUint64Result UdpDefaultWriter::writePacket(const Buffer::Instance& buffer,
      14             :                                                       const Address::Ip* local_ip,
      15           0 :                                                       const Address::Instance& peer_address) {
      16           0 :   ASSERT(!write_blocked_, "Cannot write while IO handle is blocked.");
      17           0 :   Api::IoCallUint64Result result =
      18           0 :       Utility::writeToSocket(io_handle_, buffer, local_ip, peer_address);
      19           0 :   if (result.err_ && result.err_->getErrorCode() == Api::IoError::IoErrorCode::Again) {
      20             :     // Writer is blocked when error code received is EWOULDBLOCK/EAGAIN
      21           0 :     write_blocked_ = true;
      22           0 :   }
      23           0 :   return result;
      24           0 : }
      25             : 
      26             : } // namespace Network
      27             : } // namespace Envoy

Generated by: LCOV version 1.15