Prefer grpc status over http status

test
pull/16562/head
Yash Tibrewal 6 years ago
parent a1f5c0942d
commit dd95194a08
  1. 2
      src/core/ext/transport/chttp2/transport/parsing.cc
  2. 4
      src/core/lib/surface/call.cc
  3. 20
      test/core/end2end/tests/filter_status_code.cc

@ -393,6 +393,7 @@ error_handler:
static void free_timeout(void* p) { gpr_free(p); }
static void on_initial_header(void* tp, grpc_mdelem md) {
gpr_log(GPR_INFO, "on initial header");
GPR_TIMER_SCOPE("on_initial_header", 0);
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
@ -475,6 +476,7 @@ static void on_initial_header(void* tp, grpc_mdelem md) {
}
static void on_trailing_header(void* tp, grpc_mdelem md) {
gpr_log(GPR_INFO, "on_trailing_header");
GPR_TIMER_SCOPE("on_trailing_header", 0);
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);

@ -685,10 +685,10 @@ static void cancel_with_status(grpc_call* c, grpc_status_code status,
}
static void set_final_status(grpc_call* call, grpc_error* error) {
if (grpc_call_error_trace.enabled()) {
//if (grpc_call_error_trace.enabled()) {
gpr_log(GPR_DEBUG, "set_final_status %s", call->is_client ? "CLI" : "SVR");
gpr_log(GPR_DEBUG, "%s", grpc_error_string(error));
}
//}
if (call->is_client) {
grpc_error_get_status(error, call->send_deadline,
call->final_op.client.status,

@ -249,6 +249,24 @@ typedef struct final_status_data {
grpc_call_stack* call;
} final_status_data;
static void start_transport_stream_op_batch(grpc_call_element *elem,
grpc_transport_stream_op_batch *op) {
auto* data = static_cast<final_status_data*>(elem->call_data);
if(data->call == g_server_call_stack) {
gpr_log(GPR_INFO, "here");
}
if(op->send_initial_metadata) {
auto *batch = op->payload->send_initial_metadata.send_initial_metadata;
gpr_log(GPR_INFO, "init %p %p", batch->idx.named.status, batch->idx.named.grpc_status);
grpc_metadata_batch_substitute(batch, batch->idx.named.status, GRPC_MDELEM_STATUS_404);
}
if(op->send_trailing_metadata) {
auto *batch = op->payload->send_trailing_metadata.send_trailing_metadata;
gpr_log(GPR_INFO, "trai %p %p", batch->idx.named.status, batch->idx.named.grpc_status);
}
grpc_call_next_op(elem, op);
}
static grpc_error* init_call_elem(grpc_call_element* elem,
const grpc_call_element_args* args) {
final_status_data* data = static_cast<final_status_data*>(elem->call_data);
@ -307,7 +325,7 @@ static const grpc_channel_filter test_client_filter = {
"client_filter_status_code"};
static const grpc_channel_filter test_server_filter = {
grpc_call_next_op,
start_transport_stream_op_batch,
grpc_channel_next_op,
sizeof(final_status_data),
init_call_elem,

Loading…
Cancel
Save