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
ac942f43
Commit
ac942f43
authored
8 years ago
by
Craig Tiller
Browse files
Options
Downloads
Patches
Plain Diff
Fix refcounting bug
parent
b35b2a22
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/lib/channel/deadline_filter.c
+10
-5
10 additions, 5 deletions
src/core/lib/channel/deadline_filter.c
with
10 additions
and
5 deletions
src/core/lib/channel/deadline_filter.c
+
10
−
5
View file @
ac942f43
...
@@ -43,8 +43,6 @@
...
@@ -43,8 +43,6 @@
#include
"src/core/lib/iomgr/timer.h"
#include
"src/core/lib/iomgr/timer.h"
#include
"src/core/lib/slice/slice_internal.h"
#include
"src/core/lib/slice/slice_internal.h"
#define TOMBSTONE_TIMER 1
//
//
// grpc_deadline_state
// grpc_deadline_state
//
//
...
@@ -80,11 +78,15 @@ retry:
...
@@ -80,11 +78,15 @@ retry:
(
grpc_deadline_timer_state
)
gpr_atm_acq_load
(
&
deadline_state
->
timer_state
);
(
grpc_deadline_timer_state
)
gpr_atm_acq_load
(
&
deadline_state
->
timer_state
);
switch
(
cur_state
)
{
switch
(
cur_state
)
{
case
GRPC_DEADLINE_STATE_PENDING
:
case
GRPC_DEADLINE_STATE_PENDING
:
// Note: We do not start the timer if there is already a timer
return
;
return
;
case
GRPC_DEADLINE_STATE_FINISHED
:
case
GRPC_DEADLINE_STATE_FINISHED
:
if
(
gpr_atm_rel_cas
(
&
deadline_state
->
timer_state
,
if
(
gpr_atm_rel_cas
(
&
deadline_state
->
timer_state
,
GRPC_DEADLINE_STATE_FINISHED
,
GRPC_DEADLINE_STATE_FINISHED
,
GRPC_DEADLINE_STATE_PENDING
))
{
GRPC_DEADLINE_STATE_PENDING
))
{
// If we've already created and destroyed a timer, we always create a
// new closure: we have no other guarantee that the inlined closure is
// not in use (it may hold a pending call to timer_callback)
closure
=
grpc_closure_create
(
timer_callback
,
elem
,
closure
=
grpc_closure_create
(
timer_callback
,
elem
,
grpc_schedule_on_exec_ctx
);
grpc_schedule_on_exec_ctx
);
}
else
{
}
else
{
...
@@ -104,17 +106,20 @@ retry:
...
@@ -104,17 +106,20 @@ retry:
break
;
break
;
}
}
GPR_ASSERT
(
closure
);
GPR_ASSERT
(
closure
);
GRPC_CALL_STACK_REF
(
deadline_state
->
call_stack
,
"deadline_timer"
);
grpc_timer_init
(
exec_ctx
,
&
deadline_state
->
timer
,
deadline
,
closure
,
grpc_timer_init
(
exec_ctx
,
&
deadline_state
->
timer
,
deadline
,
closure
,
gpr_now
(
GPR_CLOCK_MONOTONIC
));
gpr_now
(
GPR_CLOCK_MONOTONIC
));
GPR_UNREACHABLE_CODE
(
return
;);
}
}
// Cancels the deadline timer.
// Cancels the deadline timer.
static
void
cancel_timer_if_needed
(
grpc_exec_ctx
*
exec_ctx
,
static
void
cancel_timer_if_needed
(
grpc_exec_ctx
*
exec_ctx
,
grpc_deadline_state
*
deadline_state
)
{
grpc_deadline_state
*
deadline_state
)
{
if
(
gpr_atm_
acq_load
(
&
deadline_state
->
timer_state
)
!=
if
(
gpr_atm_
rel_cas
(
&
deadline_state
->
timer_state
,
GRPC_DEADLINE_STATE_PENDING
,
GRPC_DEADLINE_STATE_INI
TIAL
)
{
GRPC_DEADLINE_STATE_
F
INI
SHED
)
)
{
grpc_timer_cancel
(
exec_ctx
,
&
deadline_state
->
timer
);
grpc_timer_cancel
(
exec_ctx
,
&
deadline_state
->
timer
);
}
else
{
// timer was either in STATE_INITAL (nothing to cancel)
// OR in STATE_FINISHED (again nothing to cancel)
}
}
}
}
...
...
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