@@ -30,6 +30,13 @@ class SocketOptionImpl : public Socket::Option, Logger::Loggable<Logger::Id::con
3030 ASSERT (reinterpret_cast <uintptr_t >(value_.data ()) % alignof (void *) == 0 );
3131 }
3232
33+ SocketOptionImpl (Network::SocketOptionName optname, absl::string_view value,
34+ absl::optional<Network::Socket::Type> socket_type = absl::nullopt )
35+ : in_state_(absl::nullopt ), optname_(optname), value_(value.begin(), value.end()),
36+ socket_type_(socket_type) {
37+ ASSERT (reinterpret_cast <uintptr_t >(value_.data ()) % alignof (void *) == 0 );
38+ }
39+
3340 // Socket::Option
3441 bool setOption (Socket& socket,
3542 envoy::config::core::v3::SocketOption::SocketState state) const override ;
@@ -61,7 +68,9 @@ class SocketOptionImpl : public Socket::Option, Logger::Loggable<Logger::Id::con
6168 const void * value, size_t size);
6269
6370private:
64- const envoy::config::core::v3::SocketOption::SocketState in_state_;
71+ // The state this option expects the socket to be in when it is applied. If the state is not set,
72+ // then this option will be applied in any state.
73+ absl::optional<const envoy::config::core::v3::SocketOption::SocketState> in_state_;
6574 const Network::SocketOptionName optname_;
6675 // The vector's data() is used by the setsockopt syscall, which needs to be int-size-aligned on
6776 // some platforms, the AlignedAllocator here makes it pointer-size-aligned, which satisfies the
0 commit comments