From 1fd44337fc117429955a84b53f2efdee89a15c60 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Fri, 30 Mar 2018 15:41:14 -0700 Subject: [PATCH] Shutdown documentation --- src/core/lib/surface/server.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index f7505c888ec..cb34def7403 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -1161,6 +1161,22 @@ static void listener_destroy_done(void* s, grpc_error* error) { gpr_mu_unlock(&server->mu_global); } +/* + - Kills all pending requests-for-incoming-RPC-calls (i.e the requests made via + grpc_server_request_call and grpc_server_request_registered call will now be + cancelled). See 'kill_pending_work_locked()' + + - Shuts down the listeners (i.e the server will no longer listen on the port + for new incoming channels). + + - Iterates through all channels on the server and sends shutdown msg (see + 'channel_broadcaster_shutdown()' for details) to the clients via the + transport layer. The transport layer then guarantees the following: + -- Sends shutdown to the client (for eg: HTTP2 transport sends GOAWAY) + -- If the server has outstanding calls that are in the process, the + connection is NOT closed until the server is done with all those calls + -- Once, there are no more calls in progress, the channel is closed + */ void grpc_server_shutdown_and_notify(grpc_server* server, grpc_completion_queue* cq, void* tag) { listener* l;