* Tcp proxy stats for on-demand. These stats are generated only if the tcp proxy enables on demand.
const Envoy::Router::FilterConfig& routerFilterConfig() const override { return router_config_; }
const std::string& requestIDMetadataKey() const override { return request_id_metadata_key_; }
const OnDemandStats& onDemandStats() const { return shared_config_->onDemandConfig()->stats(); }
bool flushAccessLogOnConnected() const { return shared_config_->flushAccessLogOnConnected(); }
const BackOffStrategyPtr& backoffStrategy() const { return shared_config_->backoffStrategy(); };
const absl::optional<uint32_t>& maxEarlyDataBytes() const { return max_early_data_bytes_; }
void onGenericPoolReady(StreamInfo::StreamInfo* info, std::unique_ptr<GenericUpstream>&& upstream,
Network::TransportSocketOptionsConstSharedPtr upstreamTransportSocketOptions() const override {
// These two functions allow enabling/disabling reads on the upstream and downstream connections.
Network::Socket::OptionsSharedPtr getUpstreamSocketOptions() const override { return nullptr; }
void onEvent(Network::ConnectionEvent event) override { parent_.onDownstreamEvent(event); }
// Create connection to the upstream cluster. This function can be repeatedly called on upstream
// The upstream handle (either TCP or HTTP). This is set in onGenericPoolReady and should persist
// cluster is discovered. Capture the first time as the filter may try multiple times to connect
// in the filter chain to read data from the downstream connection (for eg: to parse SNI) before
bool read_disabled_due_to_buffer_{false}; // Track if we disabled reading due to buffer overflow.
// This class deals with an upstream connection that needs to finish flushing, when the downstream
// connection has been closed. The TcpProxy is destroyed when the downstream connection is closed,
class Drainer : public Event::DeferredDeletable, protected Logger::Loggable<Logger::Id::filter> {