diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/ext/transport/chttp2/transport/chttp2_transport.cc | 18 | ||||
-rw-r--r-- | src/core/ext/transport/chttp2/transport/writing.cc | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 30901d40c1..9ad271753c 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -813,6 +813,11 @@ static void set_write_state(grpc_chttp2_transport* t, write_state_name(st), reason)); t->write_state = st; if (st == GRPC_CHTTP2_WRITE_STATE_IDLE) { + grpc_chttp2_stream* s; + while (grpc_chttp2_list_pop_waiting_for_write_stream(t, &s)) { + GRPC_CLOSURE_LIST_SCHED(&s->run_after_write); + GRPC_CHTTP2_STREAM_UNREF(s, "chttp2:write_closure_sched"); + } if (t->close_transport_on_writes_finished != nullptr) { grpc_error* err = t->close_transport_on_writes_finished; t->close_transport_on_writes_finished = nullptr; @@ -1204,10 +1209,7 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t, } if (closure->next_data.scratch < CLOSURE_BARRIER_FIRST_REF_BIT) { if ((t->write_state == GRPC_CHTTP2_WRITE_STATE_IDLE) || - !(closure->next_data.scratch & CLOSURE_BARRIER_MAY_COVER_WRITE) || - closure->error_data.error != GRPC_ERROR_NONE || s->seen_error) { - // If the stream has failed, or this closure will fail, ignore - // CLOSURE_BARRIER_MAY_COVER_WRITE and run the callback immediately + !(closure->next_data.scratch & CLOSURE_BARRIER_MAY_COVER_WRITE)) { GRPC_CLOSURE_RUN(closure, closure->error_data.error); } else { if (grpc_chttp2_list_add_waiting_for_write_stream(t, s)) { @@ -1994,9 +1996,7 @@ static void remove_stream(grpc_chttp2_transport* t, uint32_t id, s->byte_stream_error = GRPC_ERROR_REF(error); } } - if (grpc_chttp2_list_remove_writable_stream(t, s)) { - GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:remove_stream"); - } + if (grpc_chttp2_stream_map_size(&t->stream_map) == 0) { post_benign_reclaimer(t); if (t->sent_goaway_state == GRPC_CHTTP2_GOAWAY_SENT) { @@ -2005,6 +2005,10 @@ static void remove_stream(grpc_chttp2_transport* t, uint32_t id, "Last stream closed after sending GOAWAY", &error, 1)); } } + if (grpc_chttp2_list_remove_writable_stream(t, s)) { + GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:remove_stream"); + } + GRPC_ERROR_UNREF(error); maybe_start_some_streams(t); diff --git a/src/core/ext/transport/chttp2/transport/writing.cc b/src/core/ext/transport/chttp2/transport/writing.cc index 9ab8ca832c..8b73b01dea 100644 --- a/src/core/ext/transport/chttp2/transport/writing.cc +++ b/src/core/ext/transport/chttp2/transport/writing.cc @@ -641,10 +641,6 @@ void grpc_chttp2_end_write(grpc_chttp2_transport* t, grpc_error* error) { } GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:end"); } - while (grpc_chttp2_list_pop_waiting_for_write_stream(t, &s)) { - GRPC_CLOSURE_LIST_SCHED(&s->run_after_write); - GRPC_CHTTP2_STREAM_UNREF(s, "chttp2:write_closure_sched"); - } grpc_slice_buffer_reset_and_unref_internal(&t->outbuf); GRPC_ERROR_UNREF(error); } |