diff options
author | Hongwei Wang <hongweiw@google.com> | 2015-08-05 16:27:54 -0700 |
---|---|---|
committer | Hongwei Wang <hongweiw@google.com> | 2015-08-05 16:27:54 -0700 |
commit | 443a7501bb2ac52a756cd829d4a39ba54968de9b (patch) | |
tree | 05c8b26b5c2cd0f975d33fc3da4f80c30897f222 /src | |
parent | bc7405c3205c09ba3ad1974e129d66b329ccf38a (diff) |
Zookeeper test add authority in client context
Diffstat (limited to 'src')
-rw-r--r-- | src/core/client_config/resolvers/zookeeper_resolver.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/core/client_config/resolvers/zookeeper_resolver.c b/src/core/client_config/resolvers/zookeeper_resolver.c index a95e866abc..658784d3ea 100644 --- a/src/core/client_config/resolvers/zookeeper_resolver.c +++ b/src/core/client_config/resolvers/zookeeper_resolver.c @@ -266,11 +266,7 @@ static char *zookeeper_parse_address(char *buffer, int buffer_len) { } } if (host != NULL && port != NULL) { - address = gpr_malloc(GRPC_MAX_SOCKADDR_SIZE); - memset(address, 0, GRPC_MAX_SOCKADDR_SIZE); - strcat(address, host); - strcat(address, ":"); - strcat(address, port); + gpr_asprintf(&address, "%s:%s", host, port); } grpc_json_destroy(json); } @@ -314,7 +310,6 @@ static void zookeeper_get_children_node_completion(int rc, const char *value, static void zookeeper_get_children_completion( int rc, const struct String_vector *children, const void *arg) { char *path; - int path_length; int status; int i; zookeeper_resolver *r = (zookeeper_resolver *)arg; @@ -335,12 +330,7 @@ static void zookeeper_get_children_completion( r->resolved_total = children->count; for (i = 0; i < children->count; i++) { - path_length = strlen(r->name) + strlen(children->data[i]) + 2; - path = (char *)gpr_malloc(path_length); - memset(path, 0, path_length); - strcat(path, r->name); - strcat(path, "/"); - strcat(path, children->data[i]); + gpr_asprintf(&path, "%s/%s", r->name, children->data[i]); status = zoo_awget(r->zookeeper_handle, path, zookeeper_watcher, r, zookeeper_get_children_node_completion, r); gpr_free(path); |