[chttp2] Fix a bug whereby trailers-only is not reported (#31537)

We don't report trailers-only if the trailers are parsed prior to executing recv_initial_metadata
pull/31543/head
Craig Tiller 2 years ago committed by GitHub
parent 7eb5fb5a25
commit e1b646465a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  2. 1
      src/core/ext/transport/chttp2/transport/internal.h
  3. 1
      src/core/ext/transport/chttp2/transport/parsing.cc

@ -1395,6 +1395,9 @@ static void perform_stream_op_locked(void* stream_op,
op_payload->recv_initial_metadata.recv_initial_metadata;
s->trailing_metadata_available =
op_payload->recv_initial_metadata.trailing_metadata_available;
if (s->parsed_trailers_only && s->trailing_metadata_available != nullptr) {
*s->trailing_metadata_available = true;
}
if (op_payload->recv_initial_metadata.peer_string != nullptr) {
gpr_atm_rel_store(op_payload->recv_initial_metadata.peer_string,
(gpr_atm)t->peer_string.c_str());

@ -514,6 +514,7 @@ struct grpc_chttp2_stream {
grpc_metadata_batch* recv_initial_metadata;
grpc_closure* recv_initial_metadata_ready = nullptr;
bool* trailing_metadata_available = nullptr;
bool parsed_trailers_only = false;
absl::optional<grpc_core::SliceBuffer>* recv_message = nullptr;
uint32_t* recv_message_flags = nullptr;
bool* call_failed_before_recv_message = nullptr;

@ -595,6 +595,7 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
if (s->trailing_metadata_available != nullptr) {
*s->trailing_metadata_available = true;
}
s->parsed_trailers_only = true;
incoming_metadata_buffer = &s->trailing_metadata_buffer;
frame_type = HPackParser::LogInfo::kTrailers;
} else {

Loading…
Cancel
Save