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
4de910df
Commit
4de910df
authored
7 years ago
by
David G. Quintas
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #11098 from dgquintas/fix_subchannel_stuffs
Fixes to subchannel and its index
parents
1cb396dc
6d8ca69e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/core/ext/filters/client_channel/subchannel.c
+1
-1
1 addition, 1 deletion
src/core/ext/filters/client_channel/subchannel.c
src/core/ext/filters/client_channel/subchannel_index.c
+11
-1
11 additions, 1 deletion
src/core/ext/filters/client_channel/subchannel_index.c
with
12 additions
and
2 deletions
src/core/ext/filters/client_channel/subchannel.c
+
1
−
1
View file @
4de910df
...
@@ -283,6 +283,7 @@ static void disconnect(grpc_exec_ctx *exec_ctx, grpc_subchannel *c) {
...
@@ -283,6 +283,7 @@ static void disconnect(grpc_exec_ctx *exec_ctx, grpc_subchannel *c) {
void
grpc_subchannel_unref
(
grpc_exec_ctx
*
exec_ctx
,
void
grpc_subchannel_unref
(
grpc_exec_ctx
*
exec_ctx
,
grpc_subchannel
*
c
GRPC_SUBCHANNEL_REF_EXTRA_ARGS
)
{
grpc_subchannel
*
c
GRPC_SUBCHANNEL_REF_EXTRA_ARGS
)
{
gpr_atm
old_refs
;
gpr_atm
old_refs
;
// add a weak ref and subtract a strong ref (atomically)
old_refs
=
ref_mutate
(
c
,
(
gpr_atm
)
1
-
(
gpr_atm
)(
1
<<
INTERNAL_REF_BITS
),
old_refs
=
ref_mutate
(
c
,
(
gpr_atm
)
1
-
(
gpr_atm
)(
1
<<
INTERNAL_REF_BITS
),
1
REF_MUTATE_PURPOSE
(
"STRONG_UNREF"
));
1
REF_MUTATE_PURPOSE
(
"STRONG_UNREF"
));
if
((
old_refs
&
STRONG_REF_MASK
)
==
(
1
<<
INTERNAL_REF_BITS
))
{
if
((
old_refs
&
STRONG_REF_MASK
)
==
(
1
<<
INTERNAL_REF_BITS
))
{
...
@@ -656,7 +657,6 @@ static bool publish_transport_locked(grpc_exec_ctx *exec_ctx,
...
@@ -656,7 +657,6 @@ static bool publish_transport_locked(grpc_exec_ctx *exec_ctx,
gpr_free
(
sw_subchannel
);
gpr_free
(
sw_subchannel
);
grpc_channel_stack_destroy
(
exec_ctx
,
stk
);
grpc_channel_stack_destroy
(
exec_ctx
,
stk
);
gpr_free
(
con
);
gpr_free
(
con
);
GRPC_SUBCHANNEL_WEAK_UNREF
(
exec_ctx
,
c
,
"connecting"
);
return
false
;
return
false
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/core/ext/filters/client_channel/subchannel_index.c
+
11
−
1
View file @
4de910df
...
@@ -183,8 +183,11 @@ grpc_subchannel *grpc_subchannel_index_register(grpc_exec_ctx *exec_ctx,
...
@@ -183,8 +183,11 @@ grpc_subchannel *grpc_subchannel_index_register(grpc_exec_ctx *exec_ctx,
enter_ctx
(
exec_ctx
);
enter_ctx
(
exec_ctx
);
grpc_subchannel
*
c
=
NULL
;
grpc_subchannel
*
c
=
NULL
;
bool
need_to_unref_constructed
;
while
(
c
==
NULL
)
{
while
(
c
==
NULL
)
{
need_to_unref_constructed
=
false
;
// Compare and swap loop:
// Compare and swap loop:
// - take a reference to the current index
// - take a reference to the current index
gpr_mu_lock
(
&
g_mu
);
gpr_mu_lock
(
&
g_mu
);
...
@@ -193,9 +196,12 @@ grpc_subchannel *grpc_subchannel_index_register(grpc_exec_ctx *exec_ctx,
...
@@ -193,9 +196,12 @@ grpc_subchannel *grpc_subchannel_index_register(grpc_exec_ctx *exec_ctx,
// - Check to see if a subchannel already exists
// - Check to see if a subchannel already exists
c
=
gpr_avl_get
(
index
,
key
);
c
=
gpr_avl_get
(
index
,
key
);
if
(
c
!=
NULL
)
{
c
=
GRPC_SUBCHANNEL_REF_FROM_WEAK_REF
(
c
,
"index_register"
);
}
if
(
c
!=
NULL
)
{
if
(
c
!=
NULL
)
{
// yes -> we're done
// yes -> we're done
GRPC_SUBCHANNEL_WEAK_UNREF
(
exec_ctx
,
constructed
,
"index_register"
)
;
need_to_unref_constructed
=
true
;
}
else
{
}
else
{
// no -> update the avl and compare/swap
// no -> update the avl and compare/swap
gpr_avl
updated
=
gpr_avl
updated
=
...
@@ -219,6 +225,10 @@ grpc_subchannel *grpc_subchannel_index_register(grpc_exec_ctx *exec_ctx,
...
@@ -219,6 +225,10 @@ grpc_subchannel *grpc_subchannel_index_register(grpc_exec_ctx *exec_ctx,
leave_ctx
(
exec_ctx
);
leave_ctx
(
exec_ctx
);
if
(
need_to_unref_constructed
)
{
GRPC_SUBCHANNEL_UNREF
(
exec_ctx
,
constructed
,
"index_register"
);
}
return
c
;
return
c
;
}
}
...
...
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