From 9c156da66afde71361d07cf785a826e20ca85c9d Mon Sep 17 00:00:00 2001
From: Makarand Dharmapurikar <makarandd@google.com>
Date: Thu, 18 May 2017 10:32:13 -0700
Subject: [PATCH] Fixes #9542

This fixes the case when a server is shutdown right after it Accept'ed
a connection. The socket needs to be closed right before the endpoint
is destroyed.
---
 src/core/ext/transport/chttp2/server/chttp2_server.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.c b/src/core/ext/transport/chttp2/server/chttp2_server.c
index b9c62c376a..2c076e821c 100644
--- a/src/core/ext/transport/chttp2/server/chttp2_server.c
+++ b/src/core/ext/transport/chttp2/server/chttp2_server.c
@@ -127,6 +127,7 @@ static void on_accept(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp,
   gpr_mu_lock(&state->mu);
   if (state->shutdown) {
     gpr_mu_unlock(&state->mu);
+    grpc_endpoint_shutdown(exec_ctx, tcp, GRPC_ERROR_NONE);
     grpc_endpoint_destroy(exec_ctx, tcp);
     gpr_free(acceptor);
     return;
-- 
GitLab