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
9374ce81
Commit
9374ce81
authored
9 years ago
by
Craig Tiller
Browse files
Options
Downloads
Patches
Plain Diff
Add comments, fix a subtle bug
parent
8f615526
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/grpc++/server.h
+1
-0
1 addition, 0 deletions
include/grpc++/server.h
src/cpp/server/server.cc
+4
-0
4 additions, 0 deletions
src/cpp/server/server.cc
with
5 additions
and
0 deletions
include/grpc++/server.h
+
1
−
0
View file @
9374ce81
...
@@ -69,6 +69,7 @@ class Server GRPC_FINAL : public GrpcLibrary, private CallHook {
...
@@ -69,6 +69,7 @@ class Server GRPC_FINAL : public GrpcLibrary, private CallHook {
ShutdownInternal
(
TimePoint
<
T
>
(
deadline
).
raw_time
());
ShutdownInternal
(
TimePoint
<
T
>
(
deadline
).
raw_time
());
}
}
// Shutdown the server, waiting for all rpc processing to finish.
void
Shutdown
()
{
ShutdownInternal
(
gpr_inf_future
(
GPR_CLOCK_MONOTONIC
));
}
void
Shutdown
()
{
ShutdownInternal
(
gpr_inf_future
(
GPR_CLOCK_MONOTONIC
));
}
// Block waiting for all work to complete (the server must either
// Block waiting for all work to complete (the server must either
...
...
This diff is collapsed.
Click to expand it.
src/cpp/server/server.cc
+
4
−
0
View file @
9374ce81
...
@@ -329,11 +329,15 @@ void Server::ShutdownInternal(gpr_timespec deadline) {
...
@@ -329,11 +329,15 @@ void Server::ShutdownInternal(gpr_timespec deadline) {
shutdown_
=
true
;
shutdown_
=
true
;
grpc_server_shutdown_and_notify
(
server_
,
cq_
.
cq
(),
new
ShutdownRequest
());
grpc_server_shutdown_and_notify
(
server_
,
cq_
.
cq
(),
new
ShutdownRequest
());
cq_
.
Shutdown
();
cq_
.
Shutdown
();
// Spin, eating requests until the completion queue is completely shutdown.
// If the deadline expires then cancel anything that's pending and keep
// spinning forever until the work is actually drained.
SyncRequest
*
request
;
SyncRequest
*
request
;
bool
ok
;
bool
ok
;
while
(
SyncRequest
::
AsyncWait
(
&
cq_
,
&
request
,
&
ok
,
deadline
))
{
while
(
SyncRequest
::
AsyncWait
(
&
cq_
,
&
request
,
&
ok
,
deadline
))
{
if
(
request
==
NULL
)
{
// deadline expired
if
(
request
==
NULL
)
{
// deadline expired
grpc_server_cancel_all_calls
(
server_
);
grpc_server_cancel_all_calls
(
server_
);
deadline
=
gpr_inf_future
(
GPR_CLOCK_MONOTONIC
);
}
else
if
(
ok
)
{
}
else
if
(
ok
)
{
SyncRequest
::
CallData
call_data
(
this
,
request
);
SyncRequest
::
CallData
call_data
(
this
,
request
);
}
}
...
...
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