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
966a448a
Commit
966a448a
authored
8 years ago
by
Dan Born
Browse files
Options
Downloads
Patches
Plain Diff
Require non-NULL exec_ctx to unref.
parent
930c2983
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/core/lib/iomgr/tcp_server.h
+2
-2
2 additions, 2 deletions
src/core/lib/iomgr/tcp_server.h
src/core/lib/iomgr/tcp_server_posix.c
+0
-11
0 additions, 11 deletions
src/core/lib/iomgr/tcp_server_posix.c
src/core/lib/iomgr/tcp_server_windows.c
+7
-12
7 additions, 12 deletions
src/core/lib/iomgr/tcp_server_windows.c
with
9 additions
and
25 deletions
src/core/lib/iomgr/tcp_server.h
+
2
−
2
View file @
966a448a
...
@@ -101,8 +101,8 @@ grpc_tcp_server *grpc_tcp_server_ref(grpc_tcp_server *s);
...
@@ -101,8 +101,8 @@ grpc_tcp_server *grpc_tcp_server_ref(grpc_tcp_server *s);
void
grpc_tcp_server_shutdown_starting_add
(
grpc_tcp_server
*
s
,
void
grpc_tcp_server_shutdown_starting_add
(
grpc_tcp_server
*
s
,
grpc_closure
*
shutdown_starting
);
grpc_closure
*
shutdown_starting
);
/* If the refcount drops to zero,
delete s, and call (exec_ctx==NULL) or enqueue
/* If the refcount drops to zero,
enqueue calls on exec_ctx to
a call (exec_ctx!=NULL) to shutdown_comp
lete. */
shutdown_listeners and de
lete
s
. */
void
grpc_tcp_server_unref
(
grpc_exec_ctx
*
exec_ctx
,
grpc_tcp_server
*
s
);
void
grpc_tcp_server_unref
(
grpc_exec_ctx
*
exec_ctx
,
grpc_tcp_server
*
s
);
/* Shutdown the fds of listeners. */
/* Shutdown the fds of listeners. */
...
...
This diff is collapsed.
Click to expand it.
src/core/lib/iomgr/tcp_server_posix.c
+
0
−
11
View file @
966a448a
...
@@ -745,22 +745,11 @@ void grpc_tcp_server_shutdown_starting_add(grpc_tcp_server *s,
...
@@ -745,22 +745,11 @@ void grpc_tcp_server_shutdown_starting_add(grpc_tcp_server *s,
void
grpc_tcp_server_unref
(
grpc_exec_ctx
*
exec_ctx
,
grpc_tcp_server
*
s
)
{
void
grpc_tcp_server_unref
(
grpc_exec_ctx
*
exec_ctx
,
grpc_tcp_server
*
s
)
{
if
(
gpr_unref
(
&
s
->
refs
))
{
if
(
gpr_unref
(
&
s
->
refs
))
{
grpc_exec_ctx
local_exec_ctx
=
GRPC_EXEC_CTX_INIT
;
bool
finish_ctx
=
false
;
/* FIXME: API allows a NULL exec_ctx, although this might cause us to delete
ourself before some enqueued work in some other exec_ctx runs. */
if
(
exec_ctx
==
NULL
)
{
exec_ctx
=
&
local_exec_ctx
;
finish_ctx
=
true
;
}
grpc_tcp_server_shutdown_listeners
(
exec_ctx
,
s
);
grpc_tcp_server_shutdown_listeners
(
exec_ctx
,
s
);
gpr_mu_lock
(
&
s
->
mu
);
gpr_mu_lock
(
&
s
->
mu
);
grpc_exec_ctx_enqueue_list
(
exec_ctx
,
&
s
->
shutdown_starting
,
NULL
);
grpc_exec_ctx_enqueue_list
(
exec_ctx
,
&
s
->
shutdown_starting
,
NULL
);
gpr_mu_unlock
(
&
s
->
mu
);
gpr_mu_unlock
(
&
s
->
mu
);
tcp_server_destroy
(
exec_ctx
,
s
);
tcp_server_destroy
(
exec_ctx
,
s
);
if
(
finish_ctx
)
{
grpc_exec_ctx_finish
(
exec_ctx
);
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/core/lib/iomgr/tcp_server_windows.c
+
7
−
12
View file @
966a448a
...
@@ -121,6 +121,9 @@ grpc_error *grpc_tcp_server_create(grpc_closure *shutdown_complete,
...
@@ -121,6 +121,9 @@ grpc_error *grpc_tcp_server_create(grpc_closure *shutdown_complete,
}
}
static
void
finish_shutdown
(
grpc_exec_ctx
*
exec_ctx
,
grpc_tcp_server
*
s
)
{
static
void
finish_shutdown
(
grpc_exec_ctx
*
exec_ctx
,
grpc_tcp_server
*
s
)
{
gpr_mu_lock
(
&
s
->
mu
);
GPR_ASSERT
(
s
->
shutdown
);
gpr_mu_unlock
(
&
s
->
mu
);
if
(
s
->
shutdown_complete
!=
NULL
)
{
if
(
s
->
shutdown_complete
!=
NULL
)
{
grpc_exec_ctx_sched
(
exec_ctx
,
s
->
shutdown_complete
,
GRPC_ERROR_NONE
,
NULL
);
grpc_exec_ctx_sched
(
exec_ctx
,
s
->
shutdown_complete
,
GRPC_ERROR_NONE
,
NULL
);
}
}
...
@@ -139,7 +142,7 @@ static void finish_shutdown(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) {
...
@@ -139,7 +142,7 @@ static void finish_shutdown(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) {
}
}
grpc_tcp_server
*
grpc_tcp_server_ref
(
grpc_tcp_server
*
s
)
{
grpc_tcp_server
*
grpc_tcp_server_ref
(
grpc_tcp_server
*
s
)
{
gpr_ref
(
&
s
->
refs
);
gpr_ref
_non_zero
(
&
s
->
refs
);
return
s
;
return
s
;
}
}
...
@@ -174,19 +177,11 @@ static void tcp_server_destroy(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) {
...
@@ -174,19 +177,11 @@ static void tcp_server_destroy(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) {
void
grpc_tcp_server_unref
(
grpc_exec_ctx
*
exec_ctx
,
grpc_tcp_server
*
s
)
{
void
grpc_tcp_server_unref
(
grpc_exec_ctx
*
exec_ctx
,
grpc_tcp_server
*
s
)
{
if
(
gpr_unref
(
&
s
->
refs
))
{
if
(
gpr_unref
(
&
s
->
refs
))
{
/* Complete shutdown_starting work before destroying. */
grpc_tcp_server_shutdown_listeners
(
exec_ctx
,
s
);
grpc_exec_ctx
local_exec_ctx
=
GRPC_EXEC_CTX_INIT
;
gpr_mu_lock
(
&
s
->
mu
);
gpr_mu_lock
(
&
s
->
mu
);
grpc_exec_ctx_enqueue_list
(
&
local_
exec_ctx
,
&
s
->
shutdown_starting
,
NULL
);
grpc_exec_ctx_enqueue_list
(
exec_ctx
,
&
s
->
shutdown_starting
,
NULL
);
gpr_mu_unlock
(
&
s
->
mu
);
gpr_mu_unlock
(
&
s
->
mu
);
if
(
exec_ctx
==
NULL
)
{
tcp_server_destroy
(
exec_ctx
,
s
);
grpc_exec_ctx_flush
(
&
local_exec_ctx
);
tcp_server_destroy
(
&
local_exec_ctx
,
s
);
grpc_exec_ctx_finish
(
&
local_exec_ctx
);
}
else
{
grpc_exec_ctx_finish
(
&
local_exec_ctx
);
tcp_server_destroy
(
exec_ctx
,
s
);
}
}
}
}
}
...
...
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