Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions source/common/router/config_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -700,10 +700,11 @@ RouteEntryImplBase::RouteEntryImplBase(const VirtualHostImpl& vhost,
}

bool RouteEntryImplBase::evaluateRuntimeMatch(const uint64_t random_value) const {
return !runtime_ ? true
: loader_.snapshot().featureEnabled(runtime_->fractional_runtime_key_,
runtime_->fractional_runtime_default_,
random_value);
return runtime_ == nullptr
? true
: loader_.snapshot().featureEnabled(runtime_->fractional_runtime_key_,
runtime_->fractional_runtime_default_,
random_value);
}

absl::string_view
Expand Down Expand Up @@ -890,18 +891,15 @@ RouteEntryImplBase::getResponseHeaderParsers(bool specificity_ascend) const {
specificity_ascend);
}

absl::optional<RouteEntryImplBase::RuntimeData>
std::unique_ptr<const RouteEntryImplBase::RuntimeData>
RouteEntryImplBase::loadRuntimeData(const envoy::config::route::v3::RouteMatch& route_match) {
absl::optional<RuntimeData> runtime;
RuntimeData runtime_data;

if (route_match.has_runtime_fraction()) {
runtime_data.fractional_runtime_default_ = route_match.runtime_fraction().default_value();
runtime_data.fractional_runtime_key_ = route_match.runtime_fraction().runtime_key();
auto runtime_data = std::make_unique<RouteEntryImplBase::RuntimeData>();
runtime_data->fractional_runtime_default_ = route_match.runtime_fraction().default_value();
runtime_data->fractional_runtime_key_ = route_match.runtime_fraction().runtime_key();
return runtime_data;
}

return runtime;
return nullptr;
}

const std::string&
Expand Down
5 changes: 3 additions & 2 deletions source/common/router/config_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,8 @@ class RouteEntryImplBase : public RouteEntryAndRoute,
absl::InlinedVector<const HeaderParser*, 3>
getResponseHeaderParsers(bool specificity_ascend) const;

absl::optional<RuntimeData> loadRuntimeData(const envoy::config::route::v3::RouteMatch& route);
std::unique_ptr<const RuntimeData>
loadRuntimeData(const envoy::config::route::v3::RouteMatch& route);

static std::multimap<std::string, std::string>
parseOpaqueConfig(const envoy::config::route::v3::Route& route);
Expand Down Expand Up @@ -1033,7 +1034,7 @@ class RouteEntryImplBase : public RouteEntryAndRoute,
const absl::optional<std::chrono::milliseconds> max_grpc_timeout_;
const absl::optional<std::chrono::milliseconds> grpc_timeout_offset_;
Runtime::Loader& loader_;
const absl::optional<RuntimeData> runtime_;
std::unique_ptr<const RuntimeData> runtime_;
const std::string scheme_redirect_;
const std::string host_redirect_;
const std::string port_redirect_;
Expand Down