#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/memory.h"
-#include "src/core/lib/iomgr/combiner.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
+#include "src/core/lib/iomgr/work_serializer.h"
#include "test/core/util/test_config.h"
constexpr int kMinResolutionPeriodMs = 1000;
extern grpc_address_resolver_vtable* grpc_resolve_address_impl;
static grpc_address_resolver_vtable* default_resolve_address;
-static grpc_core::Combiner* g_combiner;
+static std::shared_ptr<grpc_core::WorkSerializer>* g_work_serializer;
static grpc_ares_request* (*g_default_dns_lookup_ares_locked)(
const char* dns_server, const char* name, const char* default_port,
std::unique_ptr<grpc_core::ServerAddressList>* addresses,
std::unique_ptr<grpc_core::ServerAddressList>* balancer_addresses,
char** service_config_json, int query_timeout_ms,
- grpc_core::Combiner* combiner);
+ std::shared_ptr<grpc_core::WorkSerializer> work_serializer);
// Counter incremented by test_resolve_address_impl indicating the number of
// times a system-level resolution has happened.
std::unique_ptr<grpc_core::ServerAddressList>* addresses,
std::unique_ptr<grpc_core::ServerAddressList>* balancer_addresses,
char** service_config_json, int query_timeout_ms,
- grpc_core::Combiner* combiner) {
+ std::shared_ptr<grpc_core::WorkSerializer> work_serializer) {
grpc_ares_request* result = g_default_dns_lookup_ares_locked(
dns_server, name, default_port, g_iomgr_args.pollset_set, on_done,
addresses, balancer_addresses, service_config_json, query_timeout_ms,
- combiner);
+ std::move(work_serializer));
++g_resolution_count;
static grpc_millis last_resolution_time = 0;
grpc_millis now =
gpr_mu_unlock(g_iomgr_args.mu);
}
-static void start_test_under_combiner(void* arg, grpc_error* /*error*/) {
+static void start_test_under_work_serializer(void* arg) {
OnResolutionCallbackArg* res_cb_arg =
static_cast<OnResolutionCallbackArg*>(arg);
res_cb_arg->result_handler = new ResultHandler();
grpc_core::ResolverFactory* factory =
grpc_core::ResolverRegistry::LookupResolverFactory("dns");
- grpc_uri* uri = grpc_uri_parse(res_cb_arg->uri_str, 0);
+ grpc_uri* uri = grpc_uri_parse(res_cb_arg->uri_str, false);
gpr_log(GPR_DEBUG, "test: '%s' should be valid for '%s'", res_cb_arg->uri_str,
factory->scheme());
GPR_ASSERT(uri != nullptr);
grpc_core::ResolverArgs args;
args.uri = uri;
- args.combiner = g_combiner;
+ args.work_serializer = *g_work_serializer;
args.result_handler = std::unique_ptr<grpc_core::Resolver::ResultHandler>(
res_cb_arg->result_handler);
g_resolution_count = 0;
OnResolutionCallbackArg* res_cb_arg = new OnResolutionCallbackArg();
res_cb_arg->uri_str = "dns:127.0.0.1";
- g_combiner->Run(
- GRPC_CLOSURE_CREATE(start_test_under_combiner, res_cb_arg, nullptr),
- GRPC_ERROR_NONE);
+ (*g_work_serializer)
+ ->Run([res_cb_arg]() { start_test_under_work_serializer(res_cb_arg); },
+ DEBUG_LOCATION);
grpc_core::ExecCtx::Get()->Flush();
poll_pollset_until_request_done(&g_iomgr_args);
iomgr_args_finish(&g_iomgr_args);
grpc::testing::TestEnvironment env(argc, argv);
grpc_init();
- g_combiner = grpc_combiner_create();
+ auto work_serializer = std::make_shared<grpc_core::WorkSerializer>();
+ g_work_serializer = &work_serializer;
g_default_dns_lookup_ares_locked = grpc_dns_lookup_ares_locked;
grpc_dns_lookup_ares_locked = test_dns_lookup_ares_locked;
grpc_set_resolver_impl(&test_resolver);
test_cooldown();
- {
- grpc_core::ExecCtx exec_ctx;
- GRPC_COMBINER_UNREF(g_combiner, "test");
- }
- grpc_shutdown_blocking();
+
+ grpc_shutdown();
GPR_ASSERT(g_all_callbacks_invoked);
return 0;
}