LCOV - code coverage report
Current view: top level - source/common/quic - envoy_quic_server_connection.cc (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 12 28 42.9 %
Date: 2024-01-05 06:35:25 Functions: 2 4 50.0 %

          Line data    Source code
       1             : #include "source/common/quic/envoy_quic_server_connection.h"
       2             : 
       3             : #include "source/common/network/listen_socket_impl.h"
       4             : #include "source/common/quic/envoy_quic_utils.h"
       5             : #include "source/common/quic/quic_io_handle_wrapper.h"
       6             : 
       7             : namespace Envoy {
       8             : namespace Quic {
       9             : 
      10             : EnvoyQuicServerConnection::EnvoyQuicServerConnection(
      11             :     const quic::QuicConnectionId& server_connection_id,
      12             :     quic::QuicSocketAddress initial_self_address, quic::QuicSocketAddress initial_peer_address,
      13             :     quic::QuicConnectionHelperInterface& helper, quic::QuicAlarmFactory& alarm_factory,
      14             :     quic::QuicPacketWriter* writer, bool owns_writer,
      15             :     const quic::ParsedQuicVersionVector& supported_versions,
      16             :     Network::ConnectionSocketPtr connection_socket, quic::ConnectionIdGeneratorInterface& generator,
      17             :     std::unique_ptr<QuicListenerFilterManagerImpl> listener_filter_manager)
      18             :     : quic::QuicConnection(server_connection_id, initial_self_address, initial_peer_address,
      19             :                            &helper, &alarm_factory, writer, owns_writer,
      20             :                            quic::Perspective::IS_SERVER, supported_versions, generator),
      21             :       QuicNetworkConnection(std::move(connection_socket)),
      22         515 :       listener_filter_manager_(std::move(listener_filter_manager)) {
      23         515 : #ifndef WIN32
      24             :   // Defer sending while processing UDP packets till the end of the current event loop to optimize
      25             :   // UDP GSO sendmsg efficiency. But this optimization causes some test failures under Windows,
      26             :   // and Windows doesn't support GSO, do not apply this optimization on Windows.
      27             :   // TODO(#22976) Figure out if this is needed on Windows.
      28         515 :   set_defer_send_in_response_to_packets(GetQuicFlag(quic_defer_send_in_response));
      29         515 : #endif
      30         515 : }
      31             : 
      32         745 : bool EnvoyQuicServerConnection::OnPacketHeader(const quic::QuicPacketHeader& header) {
      33         745 :   quic::QuicSocketAddress old_self_address = self_address();
      34         745 :   if (!quic::QuicConnection::OnPacketHeader(header)) {
      35           0 :     return false;
      36           0 :   }
      37         745 :   if (old_self_address == self_address()) {
      38         745 :     return true;
      39         745 :   }
      40             :   // Update local address if QUICHE has updated the self address.
      41           0 :   ASSERT(self_address().IsInitialized());
      42           0 :   connectionSocket()->connectionInfoProvider().setLocalAddress(
      43           0 :       quicAddressToEnvoyAddressInstance(self_address()));
      44             : 
      45           0 :   return true;
      46         745 : }
      47             : 
      48           0 : void EnvoyQuicServerConnection::OnCanWrite() {
      49           0 :   quic::QuicConnection::OnCanWrite();
      50           0 :   onWriteEventDone();
      51           0 : }
      52             : 
      53           0 : void EnvoyQuicServerConnection::OnEffectivePeerMigrationValidated(bool is_migration_linkable) {
      54           0 :   quic::QuicConnection::OnEffectivePeerMigrationValidated(is_migration_linkable);
      55           0 :   if (listener_filter_manager_ != nullptr && networkConnection() != nullptr) {
      56             :     // This connection might become closed after this call.
      57           0 :     listener_filter_manager_->onPeerAddressChanged(effective_peer_address(), *networkConnection());
      58           0 :   }
      59           0 : }
      60             : 
      61             : } // namespace Quic
      62             : } // namespace Envoy

Generated by: LCOV version 1.15