Merge pull request #20061 from yang-g/shutdown2

return unavailable on transport closed
pull/20092/head
Yang Gao 5 years ago committed by GitHub
commit b6ae2ad69b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  2. 2
      test/core/end2end/tests/max_connection_age.cc
  3. 4
      test/core/end2end/tests/shutdown_finishes_calls.cc

@ -2465,6 +2465,13 @@ static void cancel_stream_cb(void* user_data, uint32_t key, void* stream) {
}
static void end_all_the_calls(grpc_chttp2_transport* t, grpc_error* error) {
intptr_t http2_error;
// If there is no explicit grpc or HTTP/2 error, set to UNAVAILABLE on server.
if (!t->is_client && !grpc_error_has_clear_grpc_status(error) &&
!grpc_error_get_int(error, GRPC_ERROR_INT_HTTP2_ERROR, &http2_error)) {
error = grpc_error_set_int(error, GRPC_ERROR_INT_GRPC_STATUS,
GRPC_STATUS_UNAVAILABLE);
}
cancel_stream_cb_args args = {error, t};
grpc_chttp2_stream_map_for_each(&t->stream_map, cancel_stream_cb, &args);
GRPC_ERROR_UNREF(error);

@ -204,7 +204,7 @@ static void test_max_age_forcibly_close(grpc_end2end_test_config config) {
/* The connection should be closed immediately after the max age grace period,
the in-progress RPC should fail. */
GPR_ASSERT(status == GRPC_STATUS_INTERNAL);
GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE);
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
GPR_ASSERT(was_cancelled == 1);

@ -166,9 +166,7 @@ static void test_early_server_shutdown_finishes_inflight_calls(
grpc_server_destroy(f.server);
// new code should give INTERNAL, some older code will give UNAVAILABLE
GPR_ASSERT(status == GRPC_STATUS_INTERNAL ||
status == GRPC_STATUS_UNAVAILABLE);
GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE);
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
GPR_ASSERT(was_cancelled == 1);

Loading…
Cancel
Save