|
|
|
@ -204,7 +204,8 @@ struct inproc_stream { |
|
|
|
|
t->unref(); |
|
|
|
|
|
|
|
|
|
if (closure_at_destroy) { |
|
|
|
|
GRPC_CLOSURE_SCHED(closure_at_destroy, GRPC_ERROR_NONE); |
|
|
|
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, closure_at_destroy, |
|
|
|
|
GRPC_ERROR_NONE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -390,13 +391,15 @@ void complete_if_batch_end_locked(inproc_stream* s, grpc_error* error, |
|
|
|
|
|
|
|
|
|
if ((is_sm + is_stm + is_rim + is_rm + is_rtm) == 1) { |
|
|
|
|
INPROC_LOG(GPR_INFO, "%s %p %p %p", msg, s, op, error); |
|
|
|
|
GRPC_CLOSURE_SCHED(op->on_complete, GRPC_ERROR_REF(error)); |
|
|
|
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, op->on_complete, |
|
|
|
|
GRPC_ERROR_REF(error)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void maybe_schedule_op_closure_locked(inproc_stream* s, grpc_error* error) { |
|
|
|
|
if (s && s->ops_needed && !s->op_closure_scheduled) { |
|
|
|
|
GRPC_CLOSURE_SCHED(&s->op_closure, GRPC_ERROR_REF(error)); |
|
|
|
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, &s->op_closure, |
|
|
|
|
GRPC_ERROR_REF(error)); |
|
|
|
|
s->op_closure_scheduled = true; |
|
|
|
|
s->ops_needed = false; |
|
|
|
|
} |
|
|
|
@ -471,9 +474,11 @@ void fail_helper_locked(inproc_stream* s, grpc_error* error) { |
|
|
|
|
INPROC_LOG(GPR_INFO, |
|
|
|
|
"fail_helper %p scheduling initial-metadata-ready %p %p", s, |
|
|
|
|
error, err); |
|
|
|
|
GRPC_CLOSURE_SCHED(s->recv_initial_md_op->payload->recv_initial_metadata |
|
|
|
|
.recv_initial_metadata_ready, |
|
|
|
|
err); |
|
|
|
|
grpc_core::ExecCtx::Run( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
s->recv_initial_md_op->payload->recv_initial_metadata |
|
|
|
|
.recv_initial_metadata_ready, |
|
|
|
|
err); |
|
|
|
|
// Last use of err so no need to REF and then UNREF it
|
|
|
|
|
|
|
|
|
|
complete_if_batch_end_locked( |
|
|
|
@ -484,7 +489,8 @@ void fail_helper_locked(inproc_stream* s, grpc_error* error) { |
|
|
|
|
if (s->recv_message_op) { |
|
|
|
|
INPROC_LOG(GPR_INFO, "fail_helper %p scheduling message-ready %p", s, |
|
|
|
|
error); |
|
|
|
|
GRPC_CLOSURE_SCHED( |
|
|
|
|
grpc_core::ExecCtx::Run( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
s->recv_message_op->payload->recv_message.recv_message_ready, |
|
|
|
|
GRPC_ERROR_REF(error)); |
|
|
|
|
complete_if_batch_end_locked( |
|
|
|
@ -508,9 +514,11 @@ void fail_helper_locked(inproc_stream* s, grpc_error* error) { |
|
|
|
|
if (s->recv_trailing_md_op) { |
|
|
|
|
INPROC_LOG(GPR_INFO, "fail_helper %p scheduling trailing-metadata-ready %p", |
|
|
|
|
s, error); |
|
|
|
|
GRPC_CLOSURE_SCHED(s->recv_trailing_md_op->payload->recv_trailing_metadata |
|
|
|
|
.recv_trailing_metadata_ready, |
|
|
|
|
GRPC_ERROR_REF(error)); |
|
|
|
|
grpc_core::ExecCtx::Run( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
s->recv_trailing_md_op->payload->recv_trailing_metadata |
|
|
|
|
.recv_trailing_metadata_ready, |
|
|
|
|
GRPC_ERROR_REF(error)); |
|
|
|
|
INPROC_LOG(GPR_INFO, "fail_helper %p scheduling trailing-md-on-complete %p", |
|
|
|
|
s, error); |
|
|
|
|
complete_if_batch_end_locked( |
|
|
|
@ -564,7 +572,8 @@ void message_transfer_locked(inproc_stream* sender, inproc_stream* receiver) { |
|
|
|
|
receiver->recv_stream.get()); |
|
|
|
|
INPROC_LOG(GPR_INFO, "message_transfer_locked %p scheduling message-ready", |
|
|
|
|
receiver); |
|
|
|
|
GRPC_CLOSURE_SCHED( |
|
|
|
|
grpc_core::ExecCtx::Run( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
receiver->recv_message_op->payload->recv_message.recv_message_ready, |
|
|
|
|
GRPC_ERROR_NONE); |
|
|
|
|
complete_if_batch_end_locked( |
|
|
|
@ -656,14 +665,16 @@ void op_state_machine(void* arg, grpc_error* error) { |
|
|
|
|
if (!s->t->is_client && s->trailing_md_recvd && s->recv_trailing_md_op) { |
|
|
|
|
INPROC_LOG(GPR_INFO, |
|
|
|
|
"op_state_machine %p scheduling trailing-metadata-ready", s); |
|
|
|
|
GRPC_CLOSURE_SCHED( |
|
|
|
|
grpc_core::ExecCtx::Run( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
s->recv_trailing_md_op->payload->recv_trailing_metadata |
|
|
|
|
.recv_trailing_metadata_ready, |
|
|
|
|
GRPC_ERROR_NONE); |
|
|
|
|
INPROC_LOG(GPR_INFO, |
|
|
|
|
"op_state_machine %p scheduling trailing-md-on-complete", s); |
|
|
|
|
GRPC_CLOSURE_SCHED(s->recv_trailing_md_op->on_complete, |
|
|
|
|
GRPC_ERROR_NONE); |
|
|
|
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, |
|
|
|
|
s->recv_trailing_md_op->on_complete, |
|
|
|
|
GRPC_ERROR_NONE); |
|
|
|
|
s->recv_trailing_md_op = nullptr; |
|
|
|
|
needs_close = true; |
|
|
|
|
} |
|
|
|
@ -708,9 +719,11 @@ void op_state_machine(void* arg, grpc_error* error) { |
|
|
|
|
INPROC_LOG(GPR_INFO, |
|
|
|
|
"op_state_machine %p scheduling initial-metadata-ready %p", s, |
|
|
|
|
new_err); |
|
|
|
|
GRPC_CLOSURE_SCHED(s->recv_initial_md_op->payload->recv_initial_metadata |
|
|
|
|
.recv_initial_metadata_ready, |
|
|
|
|
GRPC_ERROR_REF(new_err)); |
|
|
|
|
grpc_core::ExecCtx::Run( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
s->recv_initial_md_op->payload->recv_initial_metadata |
|
|
|
|
.recv_initial_metadata_ready, |
|
|
|
|
GRPC_ERROR_REF(new_err)); |
|
|
|
|
complete_if_batch_end_locked( |
|
|
|
|
s, new_err, s->recv_initial_md_op, |
|
|
|
|
"op_state_machine scheduling recv-initial-metadata-on-complete"); |
|
|
|
@ -748,7 +761,8 @@ void op_state_machine(void* arg, grpc_error* error) { |
|
|
|
|
// satisfied
|
|
|
|
|
*s->recv_message_op->payload->recv_message.recv_message = nullptr; |
|
|
|
|
INPROC_LOG(GPR_INFO, "op_state_machine %p scheduling message-ready", s); |
|
|
|
|
GRPC_CLOSURE_SCHED( |
|
|
|
|
grpc_core::ExecCtx::Run( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
s->recv_message_op->payload->recv_message.recv_message_ready, |
|
|
|
|
GRPC_ERROR_NONE); |
|
|
|
|
complete_if_batch_end_locked( |
|
|
|
@ -785,12 +799,14 @@ void op_state_machine(void* arg, grpc_error* error) { |
|
|
|
|
INPROC_LOG(GPR_INFO, |
|
|
|
|
"op_state_machine %p scheduling trailing-md-on-complete %p", |
|
|
|
|
s, new_err); |
|
|
|
|
GRPC_CLOSURE_SCHED( |
|
|
|
|
grpc_core::ExecCtx::Run( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
s->recv_trailing_md_op->payload->recv_trailing_metadata |
|
|
|
|
.recv_trailing_metadata_ready, |
|
|
|
|
GRPC_ERROR_REF(new_err)); |
|
|
|
|
GRPC_CLOSURE_SCHED(s->recv_trailing_md_op->on_complete, |
|
|
|
|
GRPC_ERROR_REF(new_err)); |
|
|
|
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, |
|
|
|
|
s->recv_trailing_md_op->on_complete, |
|
|
|
|
GRPC_ERROR_REF(new_err)); |
|
|
|
|
s->recv_trailing_md_op = nullptr; |
|
|
|
|
needs_close = true; |
|
|
|
|
} else { |
|
|
|
@ -810,7 +826,8 @@ void op_state_machine(void* arg, grpc_error* error) { |
|
|
|
|
// recv_message_op
|
|
|
|
|
INPROC_LOG(GPR_INFO, "op_state_machine %p scheduling message-ready", s); |
|
|
|
|
*s->recv_message_op->payload->recv_message.recv_message = nullptr; |
|
|
|
|
GRPC_CLOSURE_SCHED( |
|
|
|
|
grpc_core::ExecCtx::Run( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
s->recv_message_op->payload->recv_message.recv_message_ready, |
|
|
|
|
GRPC_ERROR_NONE); |
|
|
|
|
complete_if_batch_end_locked( |
|
|
|
@ -883,9 +900,11 @@ bool cancel_stream_locked(inproc_stream* s, grpc_error* error) { |
|
|
|
|
// couldn't complete that because we hadn't yet sent out trailing
|
|
|
|
|
// md, now's the chance
|
|
|
|
|
if (!s->t->is_client && s->trailing_md_recvd && s->recv_trailing_md_op) { |
|
|
|
|
GRPC_CLOSURE_SCHED(s->recv_trailing_md_op->payload->recv_trailing_metadata |
|
|
|
|
.recv_trailing_metadata_ready, |
|
|
|
|
GRPC_ERROR_REF(s->cancel_self_error)); |
|
|
|
|
grpc_core::ExecCtx::Run( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
s->recv_trailing_md_op->payload->recv_trailing_metadata |
|
|
|
|
.recv_trailing_metadata_ready, |
|
|
|
|
GRPC_ERROR_REF(s->cancel_self_error)); |
|
|
|
|
complete_if_batch_end_locked( |
|
|
|
|
s, s->cancel_self_error, s->recv_trailing_md_op, |
|
|
|
|
"cancel_stream scheduling trailing-md-on-complete"); |
|
|
|
@ -1026,7 +1045,8 @@ void perform_stream_op(grpc_transport* gt, grpc_stream* gs, |
|
|
|
|
(op->recv_message && other && other->send_message_op != nullptr) || |
|
|
|
|
(s->to_read_trailing_md_filled || s->trailing_md_recvd)) { |
|
|
|
|
if (!s->op_closure_scheduled) { |
|
|
|
|
GRPC_CLOSURE_SCHED(&s->op_closure, GRPC_ERROR_NONE); |
|
|
|
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, &s->op_closure, |
|
|
|
|
GRPC_ERROR_NONE); |
|
|
|
|
s->op_closure_scheduled = true; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
@ -1054,7 +1074,8 @@ void perform_stream_op(grpc_transport* gt, grpc_stream* gs, |
|
|
|
|
GPR_INFO, |
|
|
|
|
"perform_stream_op error %p scheduling initial-metadata-ready %p", |
|
|
|
|
s, error); |
|
|
|
|
GRPC_CLOSURE_SCHED( |
|
|
|
|
grpc_core::ExecCtx::Run( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
op->payload->recv_initial_metadata.recv_initial_metadata_ready, |
|
|
|
|
GRPC_ERROR_REF(error)); |
|
|
|
|
} |
|
|
|
@ -1063,22 +1084,24 @@ void perform_stream_op(grpc_transport* gt, grpc_stream* gs, |
|
|
|
|
GPR_INFO, |
|
|
|
|
"perform_stream_op error %p scheduling recv message-ready %p", s, |
|
|
|
|
error); |
|
|
|
|
GRPC_CLOSURE_SCHED(op->payload->recv_message.recv_message_ready, |
|
|
|
|
GRPC_ERROR_REF(error)); |
|
|
|
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, |
|
|
|
|
op->payload->recv_message.recv_message_ready, |
|
|
|
|
GRPC_ERROR_REF(error)); |
|
|
|
|
} |
|
|
|
|
if (op->recv_trailing_metadata) { |
|
|
|
|
INPROC_LOG( |
|
|
|
|
GPR_INFO, |
|
|
|
|
"perform_stream_op error %p scheduling trailing-metadata-ready %p", |
|
|
|
|
s, error); |
|
|
|
|
GRPC_CLOSURE_SCHED( |
|
|
|
|
grpc_core::ExecCtx::Run( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
op->payload->recv_trailing_metadata.recv_trailing_metadata_ready, |
|
|
|
|
GRPC_ERROR_REF(error)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
INPROC_LOG(GPR_INFO, "perform_stream_op %p scheduling on_complete %p", s, |
|
|
|
|
error); |
|
|
|
|
GRPC_CLOSURE_SCHED(on_complete, GRPC_ERROR_REF(error)); |
|
|
|
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_complete, GRPC_ERROR_REF(error)); |
|
|
|
|
} |
|
|
|
|
if (needs_close) { |
|
|
|
|
close_other_side_locked(s, "perform_stream_op:other_side"); |
|
|
|
@ -1121,7 +1144,7 @@ void perform_transport_op(grpc_transport* gt, grpc_transport_op* op) { |
|
|
|
|
t->accept_stream_data = op->set_accept_stream_user_data; |
|
|
|
|
} |
|
|
|
|
if (op->on_consumed) { |
|
|
|
|
GRPC_CLOSURE_SCHED(op->on_consumed, GRPC_ERROR_NONE); |
|
|
|
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, op->on_consumed, GRPC_ERROR_NONE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool do_close = false; |
|
|
|
|