Merge pull request #24335 from markdroth/get_service_config_from_config_selector

Call needs to hold a ref to the service config containing the method configs.
pull/24342/head
Mark D. Roth 4 years ago committed by GitHub
commit 99c32a21df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/core/ext/filters/client_channel/client_channel.cc
  2. 4
      src/core/ext/filters/client_channel/config_selector.h

@ -3953,8 +3953,7 @@ grpc_error* CallData::ApplyServiceConfigToCallLocked(
chand, this);
}
ConfigSelector* config_selector = chand->config_selector();
auto service_config = chand->service_config();
if (service_config != nullptr) {
if (config_selector != nullptr) {
// Use the ConfigSelector to determine the config for the call.
ConfigSelector::CallConfig call_config =
config_selector->GetCallConfig({&path_, initial_metadata, arena_});
@ -3967,7 +3966,8 @@ grpc_error* CallData::ApplyServiceConfigToCallLocked(
// so that it can be accessed by filters in the subchannel, and it
// will be cleaned up when the call ends.
auto* service_config_call_data = arena_->New<ServiceConfigCallData>(
std::move(service_config), call_config.method_configs, call_context_);
std::move(call_config.service_config), call_config.method_configs,
call_context_);
// Apply our own method params to the call.
method_params_ = static_cast<ClientChannelMethodParsedConfig*>(
service_config_call_data->GetMethodParsedConfig(

@ -55,6 +55,9 @@ class ConfigSelector : public RefCounted<ConfigSelector> {
// The per-method parsed configs that will be passed to
// ServiceConfigCallData.
const ServiceConfigParser::ParsedConfigVector* method_configs = nullptr;
// A ref to the service config that contains method_configs, held by
// the call to ensure that method_configs lives long enough.
RefCountedPtr<ServiceConfig> service_config;
// Call attributes that will be accessible to LB policy implementations.
std::map<const char*, absl::string_view> call_attributes;
// A callback that, if set, will be invoked when the call is
@ -106,6 +109,7 @@ class DefaultConfigSelector : public ConfigSelector {
CallConfig call_config;
call_config.method_configs =
service_config_->GetMethodParsedConfigVector(*args.path);
call_config.service_config = service_config_;
return call_config;
}

Loading…
Cancel
Save