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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
1f0fc53e
Commit
1f0fc53e
authored
7 years ago
by
David Garcia Quintas
Browse files
Options
Downloads
Patches
Plain Diff
Have the fake resolver "re-resolve" upon seeing error
parent
38ba4661
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c
+14
-1
14 additions, 1 deletion
.../ext/filters/client_channel/resolver/fake/fake_resolver.c
with
14 additions
and
1 deletion
src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c
+
14
−
1
View file @
1f0fc53e
...
...
@@ -56,6 +56,10 @@ typedef struct {
// grpc_resolver_next_locked()'s closure.
grpc_channel_args
*
next_results
;
// Results to use for the pretended re-resolution in
// fake_resolver_channel_saw_error_locked().
grpc_channel_args
*
results_upon_error
;
// pending next completion, or NULL
grpc_closure
*
next_completion
;
// target result address for next completion
...
...
@@ -65,6 +69,7 @@ typedef struct {
static
void
fake_resolver_destroy
(
grpc_exec_ctx
*
exec_ctx
,
grpc_resolver
*
gr
)
{
fake_resolver
*
r
=
(
fake_resolver
*
)
gr
;
grpc_channel_args_destroy
(
exec_ctx
,
r
->
next_results
);
grpc_channel_args_destroy
(
exec_ctx
,
r
->
results_upon_error
);
grpc_channel_args_destroy
(
exec_ctx
,
r
->
channel_args
);
gpr_free
(
r
);
}
...
...
@@ -87,15 +92,19 @@ static void fake_resolver_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx,
*
r
->
target_result
=
grpc_channel_args_union
(
r
->
next_results
,
r
->
channel_args
);
grpc_channel_args_destroy
(
exec_ctx
,
r
->
next_results
);
r
->
next_results
=
NULL
;
GRPC_CLOSURE_SCHED
(
exec_ctx
,
r
->
next_completion
,
GRPC_ERROR_NONE
);
r
->
next_completion
=
NULL
;
r
->
next_results
=
NULL
;
}
}
static
void
fake_resolver_channel_saw_error_locked
(
grpc_exec_ctx
*
exec_ctx
,
grpc_resolver
*
resolver
)
{
fake_resolver
*
r
=
(
fake_resolver
*
)
resolver
;
if
(
r
->
next_results
==
NULL
&&
r
->
results_upon_error
!=
NULL
)
{
// Pretend we re-resolved.
r
->
next_results
=
grpc_channel_args_copy
(
r
->
results_upon_error
);
}
fake_resolver_maybe_finish_next_locked
(
exec_ctx
,
r
);
}
...
...
@@ -151,6 +160,10 @@ static void set_response_cb(grpc_exec_ctx* exec_ctx, void* arg,
grpc_channel_args_destroy
(
exec_ctx
,
r
->
next_results
);
}
r
->
next_results
=
generator
->
next_response
;
if
(
r
->
results_upon_error
!=
NULL
)
{
grpc_channel_args_destroy
(
exec_ctx
,
r
->
results_upon_error
);
}
r
->
results_upon_error
=
grpc_channel_args_copy
(
generator
->
next_response
);
fake_resolver_maybe_finish_next_locked
(
exec_ctx
,
r
);
}
...
...
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
register
or
sign in
to comment