Merge pull request #13632 from markdroth/inproc_trailing_metadata_available

Change inproc transport to set trailing_metadata_available.
reviewable/pr13494/r9^2
Mark D. Roth 7 years ago committed by GitHub
commit 7fbbc23f77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 23
      src/core/ext/transport/inproc/inproc_transport.cc

@ -458,6 +458,14 @@ static void fail_helper_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
} else { } else {
err = GRPC_ERROR_REF(error); err = GRPC_ERROR_REF(error);
} }
if (s->recv_initial_md_op->payload->recv_initial_metadata
.trailing_metadata_available != nullptr) {
// Set to true unconditionally, because we're failing the call, so even
// if we haven't actually seen the send_trailing_metadata op from the
// other side, we're going to return trailing metadata anyway.
*s->recv_initial_md_op->payload->recv_initial_metadata
.trailing_metadata_available = true;
}
INPROC_LOG(GPR_DEBUG, INPROC_LOG(GPR_DEBUG,
"fail_helper %p scheduling initial-metadata-ready %p %p", s, "fail_helper %p scheduling initial-metadata-ready %p %p", s,
error, err); error, err);
@ -670,6 +678,12 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
nullptr); nullptr);
s->recv_initial_md_op->payload->recv_initial_metadata s->recv_initial_md_op->payload->recv_initial_metadata
.recv_initial_metadata->deadline = s->deadline; .recv_initial_metadata->deadline = s->deadline;
if (s->recv_initial_md_op->payload->recv_initial_metadata
.trailing_metadata_available != nullptr) {
*s->recv_initial_md_op->payload->recv_initial_metadata
.trailing_metadata_available =
(other != nullptr && other->send_trailing_md_op != nullptr);
}
grpc_metadata_batch_clear(exec_ctx, &s->to_read_initial_md); grpc_metadata_batch_clear(exec_ctx, &s->to_read_initial_md);
s->to_read_initial_md_filled = false; s->to_read_initial_md_filled = false;
INPROC_LOG(GPR_DEBUG, INPROC_LOG(GPR_DEBUG,
@ -995,6 +1009,15 @@ static void perform_stream_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
if (error != GRPC_ERROR_NONE) { if (error != GRPC_ERROR_NONE) {
// Schedule op's closures that we didn't push to op state machine // Schedule op's closures that we didn't push to op state machine
if (op->recv_initial_metadata) { if (op->recv_initial_metadata) {
if (op->payload->recv_initial_metadata.trailing_metadata_available !=
nullptr) {
// Set to true unconditionally, because we're failing the call, so
// even if we haven't actually seen the send_trailing_metadata op
// from the other side, we're going to return trailing metadata
// anyway.
*op->payload->recv_initial_metadata.trailing_metadata_available =
true;
}
INPROC_LOG( INPROC_LOG(
GPR_DEBUG, GPR_DEBUG,
"perform_stream_op error %p scheduling initial-metadata-ready %p", "perform_stream_op error %p scheduling initial-metadata-ready %p",

Loading…
Cancel
Save