Skip to content

Commit

Permalink
refactor response generator in client_lb_end2end_test
Browse files Browse the repository at this point in the history
  • Loading branch information
bigfacebear committed Jul 8, 2019
1 parent 1e7ec75 commit 6de222a
Show file tree
Hide file tree
Showing 2 changed files with 214 additions and 144 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,15 @@ FakeResolver::FakeResolver(ResolverArgs args)
: Resolver(args.combiner, std::move(args.result_handler)) {
GRPC_CLOSURE_INIT(&reresolution_closure_, ReturnReresolutionResult, this,
grpc_combiner_scheduler(combiner()));
channel_args_ = grpc_channel_args_copy(args.args);
FakeResolverResponseGenerator* response_generator =
FakeResolverResponseGenerator::GetFromArgs(args.args);
// Channels sharing the same subchannels may have different resolver response
// generators. If we don't remove this arg, subchannel pool will create new
// subchannels for the same address instead of reusing existing ones because
// of different values of this channel arg.
const char* args_to_remove[] = {GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR};
channel_args_ = grpc_channel_args_copy_and_remove(
args.args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove));
if (response_generator != nullptr) {
response_generator->resolver_ = this;
if (response_generator->has_result_) {
Expand Down
Loading

0 comments on commit 6de222a

Please sign in to comment.