Fix dns_resolver_connectivity_test.

pull/8462/head
Mark D. Roth 8 years ago
parent 25db523baa
commit b367c1bed7
  1. 4
      src/core/ext/resolver/dns/native/dns_resolver.c
  2. 5
      test/core/client_channel/resolvers/dns_resolver_connectivity_test.c

@ -224,7 +224,9 @@ static void dns_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,
dns_resolver *r) { dns_resolver *r) {
if (r->next_completion != NULL && if (r->next_completion != NULL &&
r->resolved_version != r->published_version) { r->resolved_version != r->published_version) {
*r->target_result = grpc_channel_args_copy(r->resolved_result); *r->target_result = r->resolved_result == NULL
? NULL
: grpc_channel_args_copy(r->resolved_result);
grpc_exec_ctx_sched(exec_ctx, r->next_completion, GRPC_ERROR_NONE, NULL); grpc_exec_ctx_sched(exec_ctx, r->next_completion, GRPC_ERROR_NONE, NULL);
r->next_completion = NULL; r->next_completion = NULL;
r->published_version = r->resolved_version; r->published_version = r->resolved_version;

@ -37,6 +37,7 @@
#include <grpc/support/alloc.h> #include <grpc/support/alloc.h>
#include "src/core/ext/client_channel/resolver_registry.h" #include "src/core/ext/client_channel/resolver_registry.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/timer.h" #include "src/core/lib/iomgr/timer.h"
#include "test/core/util/test_config.h" #include "test/core/util/test_config.h"
@ -103,7 +104,7 @@ int main(int argc, char **argv) {
grpc_resolver *resolver = create_resolver("dns:test"); grpc_resolver *resolver = create_resolver("dns:test");
grpc_resolver_result *result = (grpc_resolver_result *)1; grpc_channel_args *result = (grpc_channel_args *)1;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_event ev1; gpr_event ev1;
@ -122,7 +123,7 @@ int main(int argc, char **argv) {
GPR_ASSERT(wait_loop(30, &ev2)); GPR_ASSERT(wait_loop(30, &ev2));
GPR_ASSERT(result != NULL); GPR_ASSERT(result != NULL);
grpc_resolver_result_unref(&exec_ctx, result); grpc_channel_args_destroy(result);
GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test"); GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test");
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);

Loading…
Cancel
Save