aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/surface/server_chttp2.c
diff options
context:
space:
mode:
authorGravatar David Klempner <klempner@google.com>2015-03-05 14:17:38 -0800
committerGravatar David Klempner <klempner@google.com>2015-03-05 14:17:38 -0800
commitfd5d8ffee56c2c9c048fc88218d1d912acca529d (patch)
treebbab070b4c833379b7718a55b2bdc48290e6f1ed /src/core/surface/server_chttp2.c
parent9709188eb8302aae7270fe2b4239a46bd9b8bbd6 (diff)
Don't call grpc_create_chttp2_transport after destroying the server
Add synchronization in server_secure_chttp2.c to avoid propagating a completed handshake past that layer to a potentially already destroyed server.
Diffstat (limited to 'src/core/surface/server_chttp2.c')
-rw-r--r--src/core/surface/server_chttp2.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/surface/server_chttp2.c b/src/core/surface/server_chttp2.c
index fd702593b8..27434b39e2 100644
--- a/src/core/surface/server_chttp2.c
+++ b/src/core/surface/server_chttp2.c
@@ -53,6 +53,13 @@ static grpc_transport_setup_result setup_transport(void *server,
}
static void new_transport(void *server, grpc_endpoint *tcp) {
+ /*
+ * Beware that the call to grpc_create_chttp2_transport() has to happen before
+ * grpc_tcp_server_destroy(). This is fine here, but similar code
+ * asynchronously doing a handshake instead of calling grpc_tcp_server_start()
+ * (as in server_secure_chttp2.c) needs to add synchronization to avoid this
+ * case.
+ */
grpc_create_chttp2_transport(setup_transport, server,
grpc_server_get_channel_args(server), tcp, NULL,
0, grpc_mdctx_create(), 0);