|
|
@ -143,6 +143,7 @@ static void incoming_byte_stream_destroy_locked(grpc_exec_ctx *exec_ctx, |
|
|
|
grpc_chttp2_stream *s, |
|
|
|
grpc_chttp2_stream *s, |
|
|
|
void *byte_stream); |
|
|
|
void *byte_stream); |
|
|
|
static void fail_pending_writes(grpc_exec_ctx *exec_ctx, |
|
|
|
static void fail_pending_writes(grpc_exec_ctx *exec_ctx, |
|
|
|
|
|
|
|
grpc_chttp2_transport_global *transport_global, |
|
|
|
grpc_chttp2_stream_global *stream_global, |
|
|
|
grpc_chttp2_stream_global *stream_global, |
|
|
|
grpc_error *error); |
|
|
|
grpc_error *error); |
|
|
|
|
|
|
|
|
|
|
@ -750,7 +751,8 @@ static void terminate_writing_with_lock(grpc_exec_ctx *exec_ctx, |
|
|
|
grpc_chttp2_stream_global *stream_global; |
|
|
|
grpc_chttp2_stream_global *stream_global; |
|
|
|
while (grpc_chttp2_list_pop_closed_waiting_for_writing(&t->global, |
|
|
|
while (grpc_chttp2_list_pop_closed_waiting_for_writing(&t->global, |
|
|
|
&stream_global)) { |
|
|
|
&stream_global)) { |
|
|
|
fail_pending_writes(exec_ctx, stream_global, GRPC_ERROR_REF(error)); |
|
|
|
fail_pending_writes(exec_ctx, &t->global, stream_global, |
|
|
|
|
|
|
|
GRPC_ERROR_REF(error)); |
|
|
|
GRPC_CHTTP2_STREAM_UNREF(exec_ctx, stream_global, "finish_writes"); |
|
|
|
GRPC_CHTTP2_STREAM_UNREF(exec_ctx, stream_global, "finish_writes"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -860,9 +862,9 @@ static grpc_closure *add_closure_barrier(grpc_closure *closure) { |
|
|
|
return closure; |
|
|
|
return closure; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void grpc_chttp2_complete_closure_step(grpc_exec_ctx *exec_ctx, |
|
|
|
void grpc_chttp2_complete_closure_step( |
|
|
|
grpc_chttp2_stream_global *stream_global, |
|
|
|
grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_global *transport_global, |
|
|
|
grpc_closure **pclosure, |
|
|
|
grpc_chttp2_stream_global *stream_global, grpc_closure **pclosure, |
|
|
|
grpc_error *error) { |
|
|
|
grpc_error *error) { |
|
|
|
grpc_closure *closure = *pclosure; |
|
|
|
grpc_closure *closure = *pclosure; |
|
|
|
if (closure == NULL) { |
|
|
|
if (closure == NULL) { |
|
|
@ -874,6 +876,9 @@ void grpc_chttp2_complete_closure_step(grpc_exec_ctx *exec_ctx, |
|
|
|
if (closure->error == GRPC_ERROR_NONE) { |
|
|
|
if (closure->error == GRPC_ERROR_NONE) { |
|
|
|
closure->error = |
|
|
|
closure->error = |
|
|
|
GRPC_ERROR_CREATE("Error in HTTP transport completing operation"); |
|
|
|
GRPC_ERROR_CREATE("Error in HTTP transport completing operation"); |
|
|
|
|
|
|
|
closure->error = grpc_error_set_str( |
|
|
|
|
|
|
|
closure->error, GRPC_ERROR_STR_TARGET_ADDRESS, |
|
|
|
|
|
|
|
TRANSPORT_FROM_GLOBAL(transport_global)->peer_string); |
|
|
|
} |
|
|
|
} |
|
|
|
closure->error = grpc_error_add_child(closure->error, error); |
|
|
|
closure->error = grpc_error_add_child(closure->error, error); |
|
|
|
} |
|
|
|
} |
|
|
@ -919,6 +924,7 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, |
|
|
|
/* use final_data as a barrier until enqueue time; the inital counter is
|
|
|
|
/* use final_data as a barrier until enqueue time; the inital counter is
|
|
|
|
dropped at the end of this function */ |
|
|
|
dropped at the end of this function */ |
|
|
|
on_complete->next_data.scratch = CLOSURE_BARRIER_FIRST_REF_BIT; |
|
|
|
on_complete->next_data.scratch = CLOSURE_BARRIER_FIRST_REF_BIT; |
|
|
|
|
|
|
|
on_complete->error = GRPC_ERROR_NONE; |
|
|
|
|
|
|
|
|
|
|
|
if (op->collect_stats != NULL) { |
|
|
|
if (op->collect_stats != NULL) { |
|
|
|
GPR_ASSERT(stream_global->collecting_stats == NULL); |
|
|
|
GPR_ASSERT(stream_global->collecting_stats == NULL); |
|
|
@ -957,7 +963,7 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
grpc_chttp2_complete_closure_step( |
|
|
|
grpc_chttp2_complete_closure_step( |
|
|
|
exec_ctx, stream_global, |
|
|
|
exec_ctx, transport_global, stream_global, |
|
|
|
&stream_global->send_initial_metadata_finished, |
|
|
|
&stream_global->send_initial_metadata_finished, |
|
|
|
GRPC_ERROR_CREATE( |
|
|
|
GRPC_ERROR_CREATE( |
|
|
|
"Attempt to send initial metadata after stream was closed")); |
|
|
|
"Attempt to send initial metadata after stream was closed")); |
|
|
@ -970,7 +976,8 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, |
|
|
|
stream_global->send_message_finished = add_closure_barrier(on_complete); |
|
|
|
stream_global->send_message_finished = add_closure_barrier(on_complete); |
|
|
|
if (stream_global->write_closed) { |
|
|
|
if (stream_global->write_closed) { |
|
|
|
grpc_chttp2_complete_closure_step( |
|
|
|
grpc_chttp2_complete_closure_step( |
|
|
|
exec_ctx, stream_global, &stream_global->send_message_finished, |
|
|
|
exec_ctx, transport_global, stream_global, |
|
|
|
|
|
|
|
&stream_global->send_message_finished, |
|
|
|
GRPC_ERROR_CREATE("Attempt to send message after stream was closed")); |
|
|
|
GRPC_ERROR_CREATE("Attempt to send message after stream was closed")); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
stream_global->send_message = op->send_message; |
|
|
|
stream_global->send_message = op->send_message; |
|
|
@ -991,7 +998,7 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, |
|
|
|
} |
|
|
|
} |
|
|
|
if (stream_global->write_closed) { |
|
|
|
if (stream_global->write_closed) { |
|
|
|
grpc_chttp2_complete_closure_step( |
|
|
|
grpc_chttp2_complete_closure_step( |
|
|
|
exec_ctx, stream_global, |
|
|
|
exec_ctx, transport_global, stream_global, |
|
|
|
&stream_global->send_trailing_metadata_finished, |
|
|
|
&stream_global->send_trailing_metadata_finished, |
|
|
|
grpc_metadata_batch_is_empty(op->send_trailing_metadata) |
|
|
|
grpc_metadata_batch_is_empty(op->send_trailing_metadata) |
|
|
|
? GRPC_ERROR_NONE |
|
|
|
? GRPC_ERROR_NONE |
|
|
@ -1034,8 +1041,8 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, |
|
|
|
grpc_chttp2_list_add_check_read_ops(transport_global, stream_global); |
|
|
|
grpc_chttp2_list_add_check_read_ops(transport_global, stream_global); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
grpc_chttp2_complete_closure_step(exec_ctx, stream_global, &on_complete, |
|
|
|
grpc_chttp2_complete_closure_step(exec_ctx, transport_global, stream_global, |
|
|
|
GRPC_ERROR_NONE); |
|
|
|
&on_complete, GRPC_ERROR_NONE); |
|
|
|
|
|
|
|
|
|
|
|
GPR_TIMER_END("perform_stream_op_locked", 0); |
|
|
|
GPR_TIMER_END("perform_stream_op_locked", 0); |
|
|
|
} |
|
|
|
} |
|
|
@ -1205,7 +1212,7 @@ static void check_read_ops(grpc_exec_ctx *exec_ctx, |
|
|
|
&stream_global->received_trailing_metadata, |
|
|
|
&stream_global->received_trailing_metadata, |
|
|
|
stream_global->recv_trailing_metadata); |
|
|
|
stream_global->recv_trailing_metadata); |
|
|
|
grpc_chttp2_complete_closure_step( |
|
|
|
grpc_chttp2_complete_closure_step( |
|
|
|
exec_ctx, stream_global, |
|
|
|
exec_ctx, transport_global, stream_global, |
|
|
|
&stream_global->recv_trailing_metadata_finished, GRPC_ERROR_NONE); |
|
|
|
&stream_global->recv_trailing_metadata_finished, GRPC_ERROR_NONE); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1323,16 +1330,18 @@ void grpc_chttp2_fake_status(grpc_exec_ctx *exec_ctx, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void fail_pending_writes(grpc_exec_ctx *exec_ctx, |
|
|
|
static void fail_pending_writes(grpc_exec_ctx *exec_ctx, |
|
|
|
|
|
|
|
grpc_chttp2_transport_global *transport_global, |
|
|
|
grpc_chttp2_stream_global *stream_global, |
|
|
|
grpc_chttp2_stream_global *stream_global, |
|
|
|
grpc_error *error) { |
|
|
|
grpc_error *error) { |
|
|
|
grpc_chttp2_complete_closure_step( |
|
|
|
grpc_chttp2_complete_closure_step( |
|
|
|
exec_ctx, stream_global, &stream_global->send_initial_metadata_finished, |
|
|
|
exec_ctx, transport_global, stream_global, |
|
|
|
GRPC_ERROR_REF(error)); |
|
|
|
&stream_global->send_initial_metadata_finished, GRPC_ERROR_REF(error)); |
|
|
|
grpc_chttp2_complete_closure_step( |
|
|
|
|
|
|
|
exec_ctx, stream_global, &stream_global->send_trailing_metadata_finished, |
|
|
|
|
|
|
|
GRPC_ERROR_REF(error)); |
|
|
|
|
|
|
|
grpc_chttp2_complete_closure_step( |
|
|
|
grpc_chttp2_complete_closure_step( |
|
|
|
exec_ctx, stream_global, &stream_global->send_message_finished, error); |
|
|
|
exec_ctx, transport_global, stream_global, |
|
|
|
|
|
|
|
&stream_global->send_trailing_metadata_finished, GRPC_ERROR_REF(error)); |
|
|
|
|
|
|
|
grpc_chttp2_complete_closure_step(exec_ctx, transport_global, stream_global, |
|
|
|
|
|
|
|
&stream_global->send_message_finished, |
|
|
|
|
|
|
|
error); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void grpc_chttp2_mark_stream_closed( |
|
|
|
void grpc_chttp2_mark_stream_closed( |
|
|
@ -1358,7 +1367,8 @@ void grpc_chttp2_mark_stream_closed( |
|
|
|
grpc_chttp2_list_add_closed_waiting_for_writing(transport_global, |
|
|
|
grpc_chttp2_list_add_closed_waiting_for_writing(transport_global, |
|
|
|
stream_global); |
|
|
|
stream_global); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
fail_pending_writes(exec_ctx, stream_global, GRPC_ERROR_REF(error)); |
|
|
|
fail_pending_writes(exec_ctx, transport_global, stream_global, |
|
|
|
|
|
|
|
GRPC_ERROR_REF(error)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (stream_global->read_closed && stream_global->write_closed) { |
|
|
|
if (stream_global->read_closed && stream_global->write_closed) { |
|
|
|