diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/surface/server.c | 9 | ||||
-rw-r--r-- | src/core/surface/server.h | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/core/surface/server.c b/src/core/surface/server.c index e99e3e2b04..a60d5f7717 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -1131,3 +1131,12 @@ static void publish_registered_or_batch(grpc_call *call, int success, const grpc_channel_args *grpc_server_get_channel_args(grpc_server *server) { return server->channel_args; } + +int grpc_server_has_open_connections(grpc_server *server) { + int r; + gpr_mu_lock(&server->mu); + r = server->root_channel_data.next != &server->root_channel_data; + gpr_mu_unlock(&server->mu); + return r; +} + diff --git a/src/core/surface/server.h b/src/core/surface/server.h index c6331033e0..58f17272a4 100644 --- a/src/core/surface/server.h +++ b/src/core/surface/server.h @@ -62,4 +62,6 @@ grpc_transport_setup_result grpc_server_setup_transport( const grpc_channel_args *grpc_server_get_channel_args(grpc_server *server); +int grpc_server_has_open_connections(grpc_server *server); + #endif /* GRPC_INTERNAL_CORE_SURFACE_SERVER_H */ |