aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2015-05-27 10:55:12 -0700
committerGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2015-05-27 10:55:12 -0700
commita7628c45a52c137f01bb1b6c86763ab59f2855dd (patch)
tree1bff16cf5ed60cbc40f2cb18ce6c61c5ba1e6be7 /src/core
parent4479d7d10fc46967f532c4164b3f1a1364a531e1 (diff)
parent4ebeb402ae1ccd4f2d517b9d610f72d96be7b8a9 (diff)
Merge pull request #1745 from ctiller/misbehaving-is-expected
Add testing of bad client behavior
Diffstat (limited to 'src/core')
-rw-r--r--src/core/surface/server.c9
-rw-r--r--src/core/surface/server.h2
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 */