Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
15a71c8c
Commit
15a71c8c
authored
Aug 17, 2016
by
Yuchen Zeng
Browse files
Options
Downloads
Patches
Plain Diff
Handle multi-query results
parent
21e0a615
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.c
+11
-10
11 additions, 10 deletions
src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.c
with
11 additions
and
10 deletions
src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.c
+
11
−
10
View file @
15a71c8c
...
@@ -70,6 +70,7 @@ typedef struct grpc_ares_request {
...
@@ -70,6 +70,7 @@ typedef struct grpc_ares_request {
grpc_closure
request_closure
;
grpc_closure
request_closure
;
void
*
arg
;
void
*
arg
;
int
pending_quries
;
int
pending_quries
;
int
success
;
grpc_ares_ev_driver
*
ev_driver
;
grpc_ares_ev_driver
*
ev_driver
;
}
grpc_ares_request
;
}
grpc_ares_request
;
...
@@ -99,7 +100,7 @@ static void on_done_cb(void *arg, int status, int timeouts,
...
@@ -99,7 +100,7 @@ static void on_done_cb(void *arg, int status, int timeouts,
struct
hostent
*
hostent
)
{
struct
hostent
*
hostent
)
{
gpr_log
(
GPR_ERROR
,
"status: %d"
,
status
);
gpr_log
(
GPR_ERROR
,
"status: %d"
,
status
);
grpc_ares_request
*
r
=
(
grpc_ares_request
*
)
arg
;
grpc_ares_request
*
r
=
(
grpc_ares_request
*
)
arg
;
grpc_error
*
err
;
grpc_error
*
err
=
GRPC_ERROR_NONE
;
gpr_log
(
GPR_ERROR
,
"status: %s"
,
r
->
name
);
gpr_log
(
GPR_ERROR
,
"status: %s"
,
r
->
name
);
grpc_resolved_addresses
**
addresses
=
r
->
addrs_out
;
grpc_resolved_addresses
**
addresses
=
r
->
addrs_out
;
size_t
i
;
size_t
i
;
...
@@ -107,7 +108,9 @@ static void on_done_cb(void *arg, int status, int timeouts,
...
@@ -107,7 +108,9 @@ static void on_done_cb(void *arg, int status, int timeouts,
if
(
status
==
ARES_SUCCESS
)
{
if
(
status
==
ARES_SUCCESS
)
{
gpr_log
(
GPR_ERROR
,
"status ARES_SUCCESS"
);
gpr_log
(
GPR_ERROR
,
"status ARES_SUCCESS"
);
GRPC_ERROR_UNREF
(
err
);
err
=
GRPC_ERROR_NONE
;
err
=
GRPC_ERROR_NONE
;
r
->
success
=
1
;
if
(
*
addresses
==
NULL
)
{
if
(
*
addresses
==
NULL
)
{
*
addresses
=
gpr_malloc
(
sizeof
(
grpc_resolved_addresses
));
*
addresses
=
gpr_malloc
(
sizeof
(
grpc_resolved_addresses
));
(
*
addresses
)
->
naddrs
=
0
;
(
*
addresses
)
->
naddrs
=
0
;
...
@@ -157,17 +160,14 @@ static void on_done_cb(void *arg, int status, int timeouts,
...
@@ -157,17 +160,14 @@ static void on_done_cb(void *arg, int status, int timeouts,
}
}
}
}
// ares_destroy(r->channel);
// ares_destroy(r->channel);
}
else
{
}
else
if
(
!
r
->
success
)
{
gpr_log
(
GPR_ERROR
,
"status not ARES_SUCCESS"
);
gpr_log
(
GPR_ERROR
,
"status not ARES_SUCCESS"
);
err
=
grpc_error_set_str
(
// TODO(zyc): add more error detail
grpc_error_set_str
(
if
(
err
==
GRPC_ERROR_NONE
)
{
grpc_error_set_str
(
grpc_error_set_int
(
GRPC_ERROR_CREATE
(
"OS Error"
),
err
=
GRPC_ERROR_CREATE
(
"C-ares query error"
);
GRPC_ERROR_INT_ERRNO
,
status
),
}
GRPC_ERROR_STR_OS_ERROR
,
gai_strerror
(
status
)),
GRPC_ERROR_STR_SYSCALL
,
"getaddrinfo"
),
GRPC_ERROR_STR_TARGET_ADDRESS
,
r
->
name
);
}
}
if
(
--
r
->
pending_quries
==
0
)
{
if
(
--
r
->
pending_quries
==
0
||
err
!=
GRPC_ERROR_NONE
)
{
grpc_exec_ctx
exec_ctx
=
GRPC_EXEC_CTX_INIT
;
grpc_exec_ctx
exec_ctx
=
GRPC_EXEC_CTX_INIT
;
grpc_exec_ctx_sched
(
&
exec_ctx
,
r
->
on_done
,
err
,
NULL
);
grpc_exec_ctx_sched
(
&
exec_ctx
,
r
->
on_done
,
err
,
NULL
);
grpc_exec_ctx_flush
(
&
exec_ctx
);
grpc_exec_ctx_flush
(
&
exec_ctx
);
...
@@ -288,6 +288,7 @@ void grpc_resolve_address_ares_impl(grpc_exec_ctx *exec_ctx, const char *name,
...
@@ -288,6 +288,7 @@ void grpc_resolve_address_ares_impl(grpc_exec_ctx *exec_ctx, const char *name,
r
->
port
=
gpr_strdup
(
port
);
r
->
port
=
gpr_strdup
(
port
);
r
->
host
=
gpr_strdup
(
host
);
r
->
host
=
gpr_strdup
(
host
);
r
->
pending_quries
=
0
;
r
->
pending_quries
=
0
;
r
->
success
=
0
;
grpc_closure_init
(
&
r
->
request_closure
,
request_resolving_address
,
r
);
grpc_closure_init
(
&
r
->
request_closure
,
request_resolving_address
,
r
);
grpc_exec_ctx_sched
(
exec_ctx
,
&
r
->
request_closure
,
GRPC_ERROR_NONE
,
NULL
);
grpc_exec_ctx_sched
(
exec_ctx
,
&
r
->
request_closure
,
GRPC_ERROR_NONE
,
NULL
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment