aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2015-02-21 09:49:19 -0800
committerGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2015-02-21 09:49:19 -0800
commitc3555ce626dde857463d367c75d2dfc173229d0f (patch)
treeed691aa0ce63696eb17001a2229dc4d69074c098
parent8883e94e1ec66c28810721ab02fbd7a9e8203ba9 (diff)
parentd75fe665d1e0d1c9925f6e9e1c0384a4eab68705 (diff)
Merge pull request #705 from ctiller/fd_shutdown
Fix a double-close in the server code.
-rw-r--r--src/core/surface/server.c2
-rw-r--r--src/core/transport/chttp2_transport.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/core/surface/server.c b/src/core/surface/server.c
index a95215c5de..c99a1b4cc9 100644
--- a/src/core/surface/server.c
+++ b/src/core/surface/server.c
@@ -291,7 +291,7 @@ static void orphan_channel(channel_data *chand) {
static void finish_destroy_channel(void *cd, int success) {
channel_data *chand = cd;
grpc_server *server = chand->server;
- grpc_channel_destroy(chand->channel);
+ grpc_channel_internal_unref(chand->channel);
server_unref(server);
}
diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c
index 982417ec8a..ccd8d0c376 100644
--- a/src/core/transport/chttp2_transport.c
+++ b/src/core/transport/chttp2_transport.c
@@ -191,6 +191,7 @@ struct transport {
gpr_uint8 writing;
gpr_uint8 calling_back;
gpr_uint8 destroying;
+ gpr_uint8 closed;
error_state error_state;
/* stream indexing */
@@ -416,6 +417,7 @@ static void init_transport(transport *t, grpc_transport_setup_callback setup,
t->next_stream_id = is_client ? 1 : 2;
t->last_incoming_stream_id = 0;
t->destroying = 0;
+ t->closed = 0;
t->is_client = is_client;
t->outgoing_window = DEFAULT_WINDOW;
t->incoming_window = DEFAULT_WINDOW;
@@ -521,6 +523,8 @@ static void destroy_transport(grpc_transport *gt) {
static void close_transport(grpc_transport *gt) {
transport *t = (transport *)gt;
gpr_mu_lock(&t->mu);
+ GPR_ASSERT(!t->closed);
+ t->closed = 1;
if (t->ep) {
grpc_endpoint_shutdown(t->ep);
}