diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-06-17 07:38:20 -0700 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-06-17 07:38:20 -0700 |
commit | f932fd506dfb62a2c31c11a03249ba813a6f7acc (patch) | |
tree | 19392bb50c18ef5c02c43b6c4cb0d331323fb71a /src | |
parent | 759eb32207185ce19d61ce7043d67bd278b30006 (diff) |
Handle endpoint disconnection better
Diffstat (limited to 'src')
-rw-r--r-- | src/core/transport/chttp2/parsing.c | 5 | ||||
-rw-r--r-- | src/core/transport/chttp2/writing.c | 5 | ||||
-rw-r--r-- | src/core/transport/chttp2_transport.c | 2 |
3 files changed, 11 insertions, 1 deletions
diff --git a/src/core/transport/chttp2/parsing.c b/src/core/transport/chttp2/parsing.c index 1acf0a4b91..cea10b592e 100644 --- a/src/core/transport/chttp2/parsing.c +++ b/src/core/transport/chttp2/parsing.c @@ -667,6 +667,11 @@ static int init_rst_stream_parser( &transport_parsing->simple.rst_stream, transport_parsing->incoming_frame_size, transport_parsing->incoming_frame_flags); + transport_parsing->incoming_stream = grpc_chttp2_parsing_lookup_stream(transport_parsing, + transport_parsing->incoming_stream_id); + if (!transport_parsing->incoming_stream) { + return init_skip_frame_parser(transport_parsing, 0); + } transport_parsing->parser = grpc_chttp2_rst_stream_parser_parse; transport_parsing->parser_data = &transport_parsing->simple.rst_stream; return ok; diff --git a/src/core/transport/chttp2/writing.c b/src/core/transport/chttp2/writing.c index e7a00db062..9c51fe4d0b 100644 --- a/src/core/transport/chttp2/writing.c +++ b/src/core/transport/chttp2/writing.c @@ -144,6 +144,11 @@ void grpc_chttp2_perform_writes( GPR_ASSERT(transport_writing->outbuf.count > 0); + if (!endpoint) { + grpc_chttp2_terminate_writing(transport_writing, 0); + return; + } + switch (grpc_endpoint_write(endpoint, transport_writing->outbuf.slices, transport_writing->outbuf.count, finish_write_cb, transport_writing)) { diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 140c9ae8f6..582b7ae42a 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -522,7 +522,7 @@ void grpc_chttp2_terminate_writing( /* leave the writing flag up on shutdown to prevent further writes in unlock() from starting */ t->writing_active = 0; - if (!t->endpoint_reading) { + if (t->ep && !t->endpoint_reading) { grpc_endpoint_destroy(t->ep); t->ep = NULL; UNREF_TRANSPORT(t, "disconnect"); /* safe because we'll still have the ref for write */ |