Handle endpoint disconnection better

pull/2149/head
Craig Tiller 10 years ago
parent 759eb32207
commit f932fd506d
  1. 5
      src/core/transport/chttp2/parsing.c
  2. 5
      src/core/transport/chttp2/writing.c
  3. 2
      src/core/transport/chttp2_transport.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;

@ -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)) {

@ -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 */

Loading…
Cancel
Save