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