1
#include "source/extensions/transport_sockets/internal_upstream/internal_upstream.h"
2

            
3
namespace Envoy {
4
namespace Extensions {
5
namespace TransportSockets {
6
namespace InternalUpstream {
7

            
8
InternalSocket::InternalSocket(Network::TransportSocketPtr inner_socket,
9
                               std::unique_ptr<envoy::config::core::v3::Metadata> metadata,
10
                               const StreamInfo::FilterState::Objects& filter_state_objects)
11
19
    : PassthroughSocket(std::move(inner_socket)), metadata_(std::move(metadata)),
12
19
      filter_state_objects_(filter_state_objects) {}
13

            
14
19
void InternalSocket::setTransportSocketCallbacks(Network::TransportSocketCallbacks& callbacks) {
15
19
  transport_socket_->setTransportSocketCallbacks(callbacks);
16
19
  auto* io_handle = dynamic_cast<IoSocket::UserSpace::IoHandle*>(&callbacks.ioHandle());
17
19
  if (io_handle != nullptr && io_handle->passthroughState()) {
18
18
    io_handle->passthroughState()->initialize(std::move(metadata_), filter_state_objects_);
19
18
  }
20
19
  metadata_ = nullptr;
21
19
  filter_state_objects_.clear();
22
19
}
23

            
24
} // namespace InternalUpstream
25
} // namespace TransportSockets
26
} // namespace Extensions
27
} // namespace Envoy